Skip to main content
The Narrative SDK provides methods to upload data files to your datasets programmatically. This guide covers the upload workflow and best practices.

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

Upload workflow

The upload process involves these steps:
  1. Get an upload URL - Request a pre-signed URL for uploading
  2. Upload the file - Send the file to the pre-signed URL
  3. Confirm the upload - Notify Narrative that the upload is complete
  4. 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:
For detailed hashing instructions, see Hashing PII for Upload.

Error handling

Best practices

Troubleshooting

Hashing PII

Prepare PII for upload

Tracking Jobs

Monitor upload progress

Managing Datasets

Dataset operations