https://api.narrative.io with your API key.
1. Create the dataset
The dataset needs apinterest_conversion_event column and at least one user identifier column. Required columns lists both.
id, then activate the dataset:
201 with the dataset, now "status": "active".
Required columns
Thepinterest_conversion_event column is an object. These properties are required in every event:
The optional properties are
event_source_url, partner_name, language (all string), opt_out (boolean), custom_data, device_info, and app_info. The pinterest_conversion_event attribute gives the fields inside each object. If your schema includes device_info, declare form_factor, os_family, and network_type inside device_info.
The dataset also needs at least one of these identifier columns:
Pinterest drops an event unless its row carries a hashed email, a mobile advertising ID, or both
ip_address and user_agent. A narrative_id counts when it resolves to an email or a mobile ID. A phone number or unique_id helps Pinterest match the event but doesn’t count on its own.
Each identifier column is named after its Rosetta Stone attribute, and the connector matches on that column name. A column holds either a plain string or an object. In the dataset schema, declare a string column with "type": "string", and declare an object column with "type": "object" and its properties:
2. Confirm Pinterest accepts the dataset
Before you create a connection, ask Narrative which connector interfaces the dataset satisfies:acceptedlists each interface you can connect the dataset to, by the connector’sapp_idand theinterface_id.errorslists each interface the schema does not satisfy. Itsdetailshold the reason, such as"required property '<column>' not found".
?tags=<tag> to check only the interfaces that carry that tag.
When the interface you want is under errors, the dataset’s schema doesn’t meet what the interface needs, for example a missing column or property. Activation locks the schema, so create a new dataset that fixes what the error names.
For Pinterest, add ?tags=pinterest and look for conversion_events with "app_id": 20 in accepted:
3. Create the connection in test mode
Test mode sends each event to Pinterest with thetest flag set, so you can check your events before you send live conversions.
historical_data_enabled, test_mode_enabled, and their defaults.
Record the connection id.
4. Upload events
Each line of the file is one event, in a row that matches the schema you declared in step 1. Give every event its ownevent_id. For the columns Pinterest accepts and their shapes, see The pinterest_conversion_event attribute, Supported user identifiers, and Required columns.
You can load a file into a dataset over the API in two ways:
- Signed-URL upload. Your integration uploads one file of up to 3 GB, then asks Narrative to ingest it.
- Managed S3 bucket. You write files to an S3 bucket that Narrative manages, and Narrative ingests each batch on its own. Use a managed bucket for files larger than 3 GB, or for files that another system delivers on a schedule.
Choose a file format
The dataset’sfile_config.type sets the format of every file you load into it. Parquet and JSON Lines both hold object columns, which nest properties inside one column:
- Parquet (
parquet) is the most compatible format for connector datasets. It stores nested struct columns and their types natively, and Narrative matches columns to the schema by name at every level. - JSON Lines (
json) holds one JSON object per line. Narrative matches each nested object to the schema by name.
flat) hold only scalar columns, so they can’t carry object columns.
Upload a file with a signed URL
Request an upload URL, then send the file straight to storage:PUT.
Then ingest the file into the dataset, passing that path as source_file:
Write files to a managed S3 bucket
A managed bucket is an S3 bucket that Narrative creates for your company. You write each batch of files into its own folder under the dataset’s path in the bucket, then write an empty_NIO_COMMIT file into that batch folder. Narrative ingests every file in the batch folder when the commit file appears, so you make no upload or ingest request. A file can be as large as S3 accepts.
See Ingesting Files from a Managed S3 Bucket to create the bucket, grant your AWS account access, and lay out the folders.
5. Go live
Create a live connection when the test connection’s deliveries reportconversion.delivery.completed (see Delivery notifications). In the event’s data, stats.events counts the events Pinterest processed, and stats.counters counts the events sent with each identifier (email, phone, maid, external_id, and click_id). stats.rejections counts the events the connector dropped, by reason: event_too_old, missing_required_field, invalid_ad_account_id, missing_matching_identifier, and ad_account_not_in_profile.
To create the live connection, send the same request as in step 3, but set test_mode_enabled to false:
id from step 3:
Delivery notifications
Subscribe a webhook as described in Delivery notifications. The connector sendsconversion.delivery.completed when a delivery of conversion events finishes and conversion.delivery.failed when one fails.
Stopping delivery
DELETE /datasets/{dataset_id}.
Getting help
Contact your Narrative relationship manager with your company ID, the dataset ID, and the connection ID.Related content
Pinterest Conversions API Connector
Event fields, event names, and user identifiers
Delivering audiences via the API
Deliver hashed emails to a Pinterest audience
Hashing PII
Prepare identifiers for delivery
API Keys
Create and rotate keys for programmatic access

