Cloudflare D1 icon

Cloudflare D1

Execute operations against Cloudflare D1 serverless databases. Supports structured operations (Insert, Select, Update, Delete), raw SQL queries, and can be used as a tool by AI Agents.

Table → Insert

AI-generated

Summary

Insert rows into a Cloudflare D1 table.

Inputs

  • databaseId (required) — The unique identifier of the Cloudflare D1 database.
  • table (required) — The name or identifier of the table to insert into.
  • columnValues — Columns and values to insert; add multiple columns using "Add Column".

Output shape

Result object containing success flag, results array, meta with rows_written and last_row_id.

Returns an object indicating success; on error an exception is thrown.

Examples

Example 1: Add a new user record

Database ID: 12345, Table: users, Columns: [{"name":"name","value":"Alice"},{"name":"email","value":"alice@example.com"}]

Example 2: Insert multiple columns at once

Database ID: 12345, Table: orders, Columns: [{"name":"product","value":"Widget"},{"name":"price","value":19.99},{"name":"quantity","value":2}]

Discussion