Data Import

Import data from JSON, CSV, SQL, or Excel files into existing tables.

  • Endpoint: POST /studio/api/import/data (multipart file upload)
  • Only available when ReadOnly is false
  • Supported file extensions: .json, .csv, .sql, .xlsx
  • Tables must already exist - data import does not create tables

JSON Import

Can import data for multiple tables at once:

{
  "users": [
    {"name": "Alice", "email": "alice@example.com"},
    {"name": "Bob", "email": "bob@example.com"}
  ],
  "posts": [
    {"title": "Hello", "user_id": 1}
  ]
}

Or single-table format with the table query parameter:

curl -X POST "http://localhost:8080/studio/api/import/data?table=users" \
  -F "file=@users.json"

CSV Import

Requires the table query parameter. First row must be column headers:

name,email
Alice,alice@example.com
Bob,bob@example.com
curl -X POST "http://localhost:8080/studio/api/import/data?table=users" \
  -F "file=@users.csv"

SQL Import

Upload a .sql file containing INSERT statements. Only INSERT statements are processed; all other statements are skipped for safety.

INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com');
INSERT INTO users (name, email) VALUES ('Bob', 'bob@example.com');

Excel Import

Upload an .xlsx file. Requires the table query parameter. First row must be column headers.

curl -X POST "http://localhost:8080/studio/api/import/data?table=users" \
  -F "file=@users.xlsx"

Response

{
  "rows_imported": 15,
  "table": "users"
}

For multi-table JSON imports:

{
  "tables": {
    "users": {"rows_imported": 10},
    "posts": {"rows_imported": 5}
  }
}