SheetSQL API

Convert CSV and JSON to production-ready Postgres SQL. One API call. Auto-detects types. Zero config.

# Convert CSV to Postgres SQL in one call
curl -X POST https://api.sheetsql.dev/v1/convert \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": "name,age\nAlice,30\nBob,25", "tableName": "users"}'

# Response:
{
  "ddl": "CREATE TABLE public.users (\n  id bigint GENERATED ...\n);",
  "inserts": "INSERT INTO public.users ...",
  "columns": [{ "pgType": "text", ... }]
}

Smart Type Detection

Auto-detects uuid, integer, numeric, boolean, timestamp, jsonb, and more from your data.

3 Output Formats

CREATE TABLE DDL, batched INSERT statements, and COPY from stdin - all optimized for Postgres.

SQL Formatter

Format messy SQL and detect common issues like UPDATE without WHERE, SELECT *, bad pagination.

Zero Config

Just send your data. We handle delimiter detection, type inference, reserved word escaping, everything.

Pricing

Start free. Upgrade when you need more.

Free

$0/mo
  • 100 API calls/month
  • All endpoints included
  • Community support

Pro

$29/mo
  • 50,000 API calls/month
  • All endpoints included
  • Priority support
  • Batch processing
  • Webhook delivery

Get your API key

Enter your email to get a free API key instantly. No credit card required.

Try it live

Paste CSV or JSON data below and see the generated SQL instantly. No API key needed.

API Reference

# POST /v1/convert - Convert CSV/JSON to SQL
{
  "data": "your CSV or JSON string",
  "tableName": "users",         // optional, default: imported_data
  "schema": "public",            // optional
  "addId": true,                 // optional, auto-increment id
  "includeIndexes": true         // optional, suggest indexes
}

# POST /v1/format - Format SQL
{ "sql": "select * from users where id=1" }

# POST /v1/analyze - Format + find issues
{ "sql": "delete from users" }

# GET /v1/usage - Check your usage