For recurring uploads, consider using Automated Syncs instead of manual SDK uploads.
Prerequisites
- SDK installed and configured (see SDK Quickstart)
- A target dataset (see Managing Datasets)
- An API key with write permissions
- Data file in a supported format (CSV, JSON, Parquet)
Supported formats
| Format | Extension | Notes |
|---|---|---|
| CSV | .csv | Comma-separated values with headers |
| JSON | .json | JSON Lines (one object per line) or JSON array |
| Parquet | .parquet | Apache Parquet columnar format |
Upload workflow
The upload process involves these steps:- Get an upload URL - Request a pre-signed URL for uploading
- Upload the file - Send the file to the pre-signed URL
- Confirm the upload - Notify Narrative that the upload is complete
- Monitor ingestion - Track the ingestion job status
Basic upload
Here’s a complete example using Node.js:Ingesting from a URL
If your data is already accessible via URL, you can ingest directly:Monitoring upload status
After confirming an upload, monitor the ingestion job:Uploading multiple files
Upload multiple files to the same dataset:Data preparation
Before uploading, ensure your data meets the dataset schema requirements.CSV files
- Include a header row matching schema field names
- Use consistent formatting for dates and timestamps
- Handle special characters properly (escape or quote)
JSON files
Use JSON Lines format (one object per line):Hashing PII
If your data contains PII, hash it before uploading:Error handling
Best practices
| Practice | Description |
|---|---|
| Validate before upload | Check file format and schema match |
| Hash PII | Never upload unhashed personal data |
| Use appropriate formats | Parquet for large datasets, CSV/JSON for smaller |
| Monitor jobs | Track ingestion status to catch failures |
| Handle errors | Implement retry logic for transient failures |
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| Schema mismatch | File columns don’t match dataset schema | Verify column names and types |
| Upload timeout | File too large or slow connection | Try smaller files or increase timeout |
| Permission denied | API key lacks write access | Check API key permissions |
| Invalid format | File format not recognized | Verify file extension and content |

