Choose a guide
File delivery
Create a dataset, upload rows, connect it to your bucket, and keep delivering as new rows arrive.
Prerequisites
API key
Create the key under Settings → API Keys with read and write ondatasets and connections, write on uploads, and read on installations, apps, and app_profiles. See API Keys for the procedure and the Permissions Reference for what each resource covers.
Create it from a shared team account rather than a personal login, so the integration keeps working when someone changes roles.
S3 Connector installed
The S3 Connector is app7. Find your installation of it:
"app_id": 7, install the S3 Connector from the Narrative Marketplace.
A profile for your bucket
A connector profile names one S3 bucket and the file format Narrative writes into it. You set up a profile once per bucket, in the Narrative UI, with access to the bucket’s settings in AWS:1
Open the connector
In Narrative, go to Installed Apps, select S3 Connector, and choose Add profile.
2
Name the profile and bucket
Enter a profile name, a description, and the name of the bucket Narrative delivers to.
3
Apply the bucket policy in AWS
Copy the bucket policy the wizard shows, and apply it in the AWS console under the bucket’s Permissions → Bucket policy, or with
aws s3api put-bucket-policy. The policy lets Narrative’s delivery role write, list, and delete objects in the bucket. You can also fetch the policy over the API, as shown in Get the bucket policy.4
Tag the bucket in AWS
Add the tag the wizard shows to the bucket, under Properties → Tags. The tag is named
NARRATIVE_S3_CONNECTOR_ID, and its value ties the bucket to your company.5
Test access
Run the wizard’s access test. Narrative writes, lists, and deletes a test object in the bucket and reads the tag.
6
Choose the file format and save
Choose CSV, TSV, JSON, or Parquet. For CSV or TSV, also set the delimiter, quote, and escape characters, and whether to include a header row. Choose Save and finish, and the profile is enabled and ready for connections.
Set up API access
The guide talks to two hosts, and each takes its own credential:Get an installation token
The S3 connector authenticates requests with an installation token, which you get by exchanging your API key. Use the installation ID from S3 Connector installed:access_token as $INSTALLATION_TOKEN. It lasts about three hours, so request a new one at the start of each run of your integration.
Confirm that both hosts answer:
api.narrative.io and the installation token to aws-s3.narrativeconnectors.com.
List your profiles
The Narrative API lists the profiles under your installation, with the status of each:GET /profiles/{profile_id} on the connector, which returns the same shape. Use a profile whose status is enabled, and record its id.
Get the bucket policy
The connector generates the bucket policy for a bucket name:Principal.
Read the delivery settings schema
Each connection carries delivery settings for the connector’sdelivery interface. The schema lists every setting with its type and description:
https://aws-s3.narrativeconnectors.com/interfaces/delivery, with no credential. What the connection does explains each field.
What the connection does
A connection’squick_settings set where and how the connection writes files. The S3 Connector has one interface, delivery. The file format, compression, and CSV options come from the profile.
Existing and new rows
A connection delivers every snapshot written to the dataset after the connection is created. Thehistorical_data_enabled quick setting decides whether the connection also delivers data that was already in the dataset when you created it:
- With
historical_data_enabledset totrue, the connection first delivers data already in the dataset, then keeps delivering new snapshots as they land. - With
historical_data_enabledset tofalse, the connection delivers only snapshots written after it was created.
historical_data_enabled delivers the dataset’s snapshots from the last historical_period_seconds before the connection was created. After that, each new snapshot is delivered as it lands.
Each source file in a snapshot becomes one object in the bucket, under <bucket_prefix>/snapshotId=<snapshot ID>/. A delivery only adds objects. When you overwrite the dataset, the new snapshot lands in a new folder and the earlier folders stay in the bucket.
Related content
Amazon S3 Connector
Supported file formats and delivery options
Connector Interfaces
Why a dataset connects to an interface rather than a connector
API Keys
Create and rotate keys for programmatic access

