api.narrative.io use your API key. Requests to pinterest.narrativeconnectors.com use the installation token.
1. Create the dataset
The dataset must carry at least one identifier column that Pinterest can match on. Required columns lists them.id in the response.
Required columns
Both audience interfaces take the same schema. The dataset needs at least one of these identifier columns:
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. Activate the dataset
201 with the dataset, now "status": "active".
3. Upload and ingest your file
Each line of the file is one row that matches the schema you declared in step 1. For the columns Pinterest accepts and their shapes, see Supported 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.
4. 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 the Pinterest Connector ("app_id": 20) in accepted. audience_first_party_new delivers to a new audience and audience_first_party_existing delivers to one you already have. Step 5 then checks the delivery settings with Pinterest itself.
5. Validate the settings
The connector can check the connection settings against Pinterest before you create anything. It confirms that the profile reaches the ad account:valid is false and validation_errors says which one, for example "Ad account <AD_ACCOUNT_ID> is not accessible. Please verify the ad account ID.".
6. Create the connection
Deliver to a new audience
To deliver to a new audience, create a connection with theaudience_first_party_new interface. The connector creates a customer list and an audience in the ad account before it answers, both named audience_name, so they exist in Pinterest Ads Manager once you get 201.
type fields are required. The outer one identifies what you are connecting, and the one inside quick_settings selects the delivery interface.
What the connection does describes every field, its allowed values, and its default.
Record the connection id. You need it to check the delivery and to stop it.
Deliver to an existing audience
To add a dataset to an audience you already have in Pinterest, pick the audience from the ad account’s audiences. Pinterest delivers data into customer list audiences, so filter the list withaudience_type=CUSTOMER_LIST:
page_size and bookmark the same way as the ad accounts list. Record the id of the audience you want.
Validate the settings as in step 5, with the audience_first_party_existing interface:
audience_first_party_existing connection from each dataset to the same audience_id.
7. Check the upload counts
The connector reads the audience and customer list behind a connection from Pinterest:customer_list.num_uploaded_user_records counts the records Pinterest has received. num_batches counts upload batches, and most deliveries add one. audience.status and audience.size come from Pinterest’s own matching, which Pinterest runs after it receives the records.
To see every Pinterest connection on a dataset or a profile:
audience.delivery.completed when a delivery to the audience finishes.
Keeping the audience current
Write new data to the dataset with the same three calls as in step 3. The connection keeps running, so new rows reach the audience without further calls. Each delivery raises the counts inaudience-status:
Stopping delivery
DELETE /datasets/{dataset_id}.
Getting help
Contact your Narrative relationship manager with your company ID, the dataset ID, the connection ID, and theaudience-status response.
Related content
Inviting a partner via the API
Let a partner connect their Pinterest account so you can deliver to it
Pinterest Connector
Supported identifiers, profiles, and invites
Connector Interfaces
Why a dataset connects to an interface rather than a connector
API Keys
Create and rotate keys for programmatic access

