Skip to main content

Import Data

Import JSON

POST /api/v1/records/import/json

Pass nested JSON — RushDB walks the structure and creates linked records automatically.

curl -X POST https://api.rushdb.com/api/v1/records/import/json \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "MOVIE",
"data": {
"title": "Inception",
"rating": 8.8,
"ACTOR": [
{"name": "Leonardo DiCaprio", "country": "USA"},
{"name": "Ken Watanabe", "country": "Japan"}
]
},
"options": {"suggestTypes": true}
}'

label is required for top-level arrays, primitive arrays, and JSON objects that have primitive top-level properties. It can be omitted for container objects whose top-level values are objects or arrays of nested records; in that case each top-level key is used as the label for its nested records:

curl -X POST https://api.rushdb.com/api/v1/records/import/json \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"data": {
"CHARACTER": [{"name": "Leia Organa"}],
"STARSHIP": [{"name": "Tantive IV"}]
},
"options": {"suggestTypes": true}
}'

Options

OptionDefaultDescription
suggestTypestrueInfer property types automatically
convertNumericValuesToNumbersfalseConvert string numbers to number type
capitalizeLabelsfalseUppercase all inferred label names
skipEmptyValuesfalseTreat empty strings ("") and empty arrays ([]) as unset — no property is created. 0 and false are kept.
relationshipType__RUSHDB__RELATION__DEFAULT__Relationship type for nested links
returnResultfalseReturn created records in the response. For imports exceeding 1000 records, this option is ignored and a summary object ({ message, count }) is returned instead.
mergeByProperty names to match on for upsert-by-property imports
mergeStrategyappendappend or rewrite. Providing either option enables upsert semantics

Import CSV

POST /api/v1/records/import/csv

curl -X POST https://api.rushdb.com/api/v1/records/import/csv \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "ACTOR",
"data": "name,country\nLeonardo DiCaprio,USA\nKen Watanabe,Japan",
"options": {"suggestTypes": true},
"parseConfig": {"header": true, "dynamicTyping": true}
}'

parseConfig options

OptionDefaultDescription
delimiter,Column separator
headertrueFirst row is header
skipEmptyLinestrueIgnore blank rows
dynamicTypingtrueAuto-convert numbers and booleans
quoteChar"Quote character
escapeChar"Escape character
newlineautoExplicit newline sequence

Upsert by Property During Import

Both import endpoints support native upsert-by-property through options.mergeBy. When an incoming row or object matches an existing record on the listed properties, RushDB updates that record instead of creating a duplicate.

mergeStrategy controls how matched records are updated:

StrategyBehaviour
append (default)Add or update incoming fields; preserve other existing fields
rewriteReplace fields with the incoming data; unmentioned fields are removed

mergeBy controls the match key:

mergeBy valueMatch behaviour
["field"]Match only on listed fields
[] or omittedMatch on all incoming property keys

JSON import upsert

curl -X POST https://api.rushdb.com/api/v1/records/import/json \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "ACTOR",
"data": [
{"name": "Leonardo DiCaprio", "country": "USA"},
{"name": "Ken Watanabe", "country": "Japan"}
],
"options": {"mergeBy": ["name"], "mergeStrategy": "append"}
}'

CSV import upsert

curl -X POST https://api.rushdb.com/api/v1/records/import/csv \
-H "Authorization: Bearer $RUSHDB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"label": "ACTOR",
"data": "name,country\nLeonardo DiCaprio,USA\nKen Watanabe,Japan",
"options": {"mergeBy": ["name"], "mergeStrategy": "rewrite"},
"parseConfig": {"header": true}
}'

See also