Import records into a database from CSV
Parses a CSV document and creates one record per row, mapping columns to fields either through explicit `mappings` or by matching column headers to field keys and labels, and reports how many rows were created, skipped, and which failed. Requires `records:write` on the database. Rejected when the CSV exceeds 10 MB, 500 columns, or 50,000 rows, when it has duplicate or unterminated columns, when a mapping targets the same field twice, or when a mapped column is not present; `onError` decides whether a bad row aborts the import or is skipped.
Authorization
apiKey Workspace API key created in Workspace settings → API keys. Scopes on the key bound what it can read and write.
In: header
Path Parameters
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/workspaces/string/databases/string/import/csv" \ -H "Content-Type: application/json" \ -d '{ "csv": "string" }'{ "data": { "created": 0, "skipped": 0, "errors": [ { "row": 0, "message": "string" } ] }}{ "_tag": "ApiNotFound", "error": "not_found", "message": "That item does not exist, or this key cannot see it.", "status": 404}{ "_tag": "ApiNotFound", "error": "not_found", "message": "That item does not exist, or this key cannot see it.", "status": 404}Duplicate a record
Creates a copy of a record with its duplicable field values and its page content, titled `<source> copy` unless `title` is given. Requires `records:write` on the database; if copying the page content fails, the copy is deleted rather than left incomplete.
Export a database's records as CSV
Reads every record in the database and returns the whole table as a CSV string, with a title column followed by one column per field, plus a suggested filename and the record count. Requires read access to the database; exports of more than 50,000 records or larger than 10 MB are rejected.