---
updatedAt: 2026-02-05T14:51:02.000Z
agentTools:
  projectIndex: https://docs.phacetlabs.com/llms.txt
---

# Insert a row and trigger automated tasks

```node Node
const API_BASE_URL = 'https://api.phacetlabs.com/api/v2';
const API_KEY = 'your-api-key'; // Replace with your actual API key
const TABLE_ID = 'tableId'; // Replace with your tableId
const SESSSION_ID = 'sessionId' // Replace with your sessionId

const ROW_DATA = {
	sessionId: SESSION_ID, // Optional field. If not provided, will default to the last created session
  cells: [
    {
      columnId: 'abc',
      value: 'text value',
    },
    {
      columnId: 'def',
      value: 'single select value',
    },
    {
      columnId: 'ghi',
      value: ['multiple select value 1', 'multiple select value 2'],
    },
    {
      columnId: 'jkl',
      value: {
        "jsonPropA": "jsonValueA",
        "jsonPropB": "jsonValueB",
      },
    },
    {
      columnId: 'mno',
      value: 'fileId', // see files section for more info
    },
  ],
}

// Example usage
async function main() {
  const table = await getTable();
  const newRow = await createRow(rowData);
}

async function getTable() {
  const response = await fetch(`${API_BASE_URL}/tables/${TABLE_ID}`, {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    }
  });

  if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
  }

  const table = await response.json();
  console.log('Fetched table:', table);
  return table;
}

async function createRow(rowData) {
  const response = await fetch(`${API_BASE_URL}/tables/${TABLE_ID}/rows`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(rowData)
  });

  if (!response.ok) {
    throw new Error(`HTTP error! status: ${response.status}`);
  }

  const createdRow = await response.json();
  console.log('Created row:', createdRow);
  return createdRow;
}

main();
```

```json Response Example
{"success":true}
```

# Fetch Table configuration

<!-- node@37,41-57 -->

Fetch your table configuration to check the information you'll need to create a row:

- list of sessions
- list of columns with their configuration

# Insert a row

<!-- node@6-33,38,59-76 -->

Build your ROW_DATA object against the your Table configuration.  
The automated tasks in your Table will be automatically triggered upon the row creation