Skip to main content

POST /api/v1/schemas//data

Insert rows into a schema’s underlying PostgreSQL table. Uses ON CONFLICT DO NOTHING to skip duplicate rows when a unique constraint exists.

Path Parameters

ParameterTypeDescription
idstringSchema ID

Request Body

FieldTypeRequiredDescription
rowsobject[]YesArray of row objects. Each key must match a column name in the schema. Between 1 and 5000 rows per request.

Example

Response — 201 Created

inserted is the number of rows actually written (from Postgres’ affected-row count), and skipped is the number dropped by ON CONFLICT DO NOTHING (duplicate rows against a unique constraint). inserted + skipped equals the number of valid rows submitted.

Error Codes

CodeReason
400Empty rows array, more than 5000 rows, per-table 5000-record limit exceeded, or the schema has no user-defined fields configured
403The schema’s backing table is outside the schema system (missing ds_ prefix)
404Schema not found
429Rate limited (20 requests per 60 seconds)
500Database insert failure

Roles

admin, editor

GET /api/v1/schemas//data

Preview rows from a schema’s underlying PostgreSQL table. Only works for tables created by the schema system (tables with ds_ prefix).

Path Parameters

ParameterTypeDescription
idstringSchema ID

Query Parameters

ParameterTypeDefaultDescription
limitinteger50Max rows to return (1-500)
offsetinteger0Pagination offset

Response

If the table does not exist yet (no data seeded), returns { "total": 0, "limit": <limit>, "offset": <offset>, "rows": [] }.

Roles

admin, editor, viewer

GET /api/v1/schemas//stats

Returns per-field statistics for a schema’s data. Results are cached for 5 minutes.

Path Parameters

ParameterTypeDescription
idstringSchema ID

Response

Field Stat Types

Numeric fields include: min, max, avg, distinctCount Text fields include: distinctCount, topValues (top 5 by frequency)

Error Codes

CodeReason
403Table name is not a schema-system table (missing ds_ prefix)
404Schema not found

Roles

admin, editor, viewer

POST /api/v1/schemas/upload

Upload a CSV file to infer column names and types. Does not create a schema or import data — only analyzes the file structure. Useful for building schema creation forms from uploaded files.

Request

Multipart form data with a single file field.
FieldTypeRequiredDescription
fileFileYesCSV file (max 50MB)

Limits

ConstraintValue
Max file size50 MB
Allowed typestext/csv, application/vnd.ms-excel, text/plain
Sample sizeFirst 1 MB of file, up to 100 rows

Example

Response

Error Codes

CodeReason
400Missing file, no columns found, or CSV parse error
413File exceeds 50 MB limit
415Invalid file type (not CSV)

Roles

admin, editor

Role Summary

EndpointMethodAllowed Roles
/schemas/{id}/dataPOSTadmin, editor
/schemas/{id}/dataGETadmin, editor, viewer
/schemas/{id}/statsGETadmin, editor, viewer
/schemas/uploadPOSTadmin, editor
See also: Schemas | Data Platform