Import contacts into an audience
The CSV import on the audience page, over the API. Every well-formed address becomes a contact if it is not one yet, and every one lands in this audience, up to 500 rows per call. Send a longer list in several calls.
Runs the real call against your workspace, with your own key.
POST /audiences/{id}/import
The CSV import on the audience page, over the API. Every well-formed address becomes a contact if it is not one yet, and every one lands in this audience, up to 500 rows per call. Send a longer list in several calls.
Example
Needs audiences:write and contacts:write, because it creates contacts. Each row is an email and an optional name of up to 200 characters.
curl -X POST "$OE/audiences/aud_4c1b8e2a7d9f05c36b4e8a71/import" -H "$AUTH" -H 'content-type: application/json' -d '{ "contacts": [ { "email": "[email protected]", "name": "Grace Hopper" }, { "email": "[email protected]", "name": "Katherine Johnson" }, { "email": "not-an-address" } ]}'{ "object": "audience_import", "audienceId": "aud_4c1b8e2a7d9f05c36b4e8a71", "created": 1, "added": 1, "skipped": 1, "invalid": ["not-an-address"]}created counts the new contacts, added the new memberships in this audience, and skipped the rows that were not imported. invalid lists the malformed addresses exactly as they were sent. A new contact is saved as manual and joins the default audience as well.
An address that is already a contact is reused, never duplicated, and keeps its name: a name here only fills one that was empty. An address that was deleted from the book becomes a contact again, and the same address twice in one call counts once.
Safe to replay: a second identical call creates nothing and adds nothing. Nothing is sent to anybody and nobody is subscribed to anything.