Headlessly
REST API

Import & Export

Bulk import and export data in JSON, NDJSON, CSV, and Parquet formats.

Import

Endpoint

POST /import/:type

Import entities in bulk. Supports JSON arrays and NDJSON (newline-delimited JSON).

JSON Import

curl -X POST "https://db.headless.ly/import/Contact" \
  -H "Authorization: Bearer hly_your_api_key" \
  -H "Content-Type: application/json" \
  -d '[
    {"name": "Alice Chen", "email": "alice@acme.com", "stage": "Lead"},
    {"name": "Bob Park", "email": "bob@widget.io", "stage": "Qualified"}
  ]'

NDJSON Import

curl -X POST "https://db.headless.ly/import/Contact" \
  -H "Authorization: Bearer hly_your_api_key" \
  -H "Content-Type: application/x-ndjson" \
  --data-binary @contacts.ndjson

Response

{
  "success": true,
  "imported": 150,
  "errors": 2,
  "details": [
    {"row": 42, "error": "Missing required field: name"},
    {"row": 99, "error": "Duplicate email: alice@acme.com"}
  ]
}

Export

Endpoint

GET /export/:type

Export all entities of a type. Supports JSON, CSV, and Parquet formats.

Parameters

ParameterTypeDefaultDescription
formatstringjsonExport format: json, csv, or parquet
filterJSON string{}Optional filter

Examples

# JSON export
curl "https://db.headless.ly/export/Contact?format=json"

# CSV export
curl "https://db.headless.ly/export/Deal?format=csv" > deals.csv

# Parquet export
curl "https://db.headless.ly/export/Contact?format=parquet" > contacts.parquet

# Filtered export
curl "https://db.headless.ly/export/Contact?format=csv&filter=%7B%22stage%22%3A%22Lead%22%7D"

On this page