> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gradial.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Import Audiences from S3

> Configure a recurring CDP export into ACI's watched S3 drop zone and verify each import.

Use this path when your CDP or data pipeline can export audience memberships to Amazon S3 on a schedule. Start with the provider and audience definitions in [External Audiences](https://docs.gradial.com/aci/personalization/external-audiences.md).

## 1. Confirm the watched destination

Your ACI administrator supplies:

* the tenant's configured audience lake bucket and AWS region;
* the ACI site ID used by that tenant;
* the provider ID, such as `customer-cdp`;
* an export role with write access to that provider's import prefix; and
* confirmation that object-created notifications and the audience importer are configured for the destination.

The destination has this shape:

```text theme={null}
s3://<audience-lake-bucket>/audience/imports/<site-id>/<provider-id>/<filename>.json
```

For the shared example, the provider prefix is:

```text theme={null}
audience/imports/<site-id>/customer-cdp/
```

The bucket is deployment configuration. The provider document's ID determines its prefix; adding a bucket name to the provider document does not register a new watched bucket. Point the CDP at the tenant's provisioned drop zone. If the CDP already exports elsewhere, configure its delivery pipeline to deliver the completed file to this destination.

Scope the CDP export role to the intended tenant/site/provider prefix. It does not need read access to serving memberships, claims, or other providers' exports. Your administrator should include any encryption permissions required by the bucket.

## 2. Configure the CDP export

In the CDP's S3 destination settings, configure the bucket, region, export credentials, and provider prefix. Export a complete membership snapshot in the format declared by the provider:

* `mapped-json`: a JSON array or JSONL using the configured identity and membership pointers;
* `aep-batch-export`: AEP records containing `identityMap` and `segmentMembership`.

Use a plain filename ending in `.json` or `.jsonl`, such as `profiles-2026-10-21.jsonl`. Complete each object before treating the export as delivered. Each completed object produces an import notification; no ACI API call is required for each scheduled delivery.

### Understand replacement before scheduling

For the shared example's `segmentIdsPath` mapping, **each accepted file replaces that provider's complete membership set**. An identity or membership missing from the new snapshot is removed for that provider. Do not split one logical snapshot into separately imported files: the later file would replace the earlier file's membership set.

If your CDP exports one file per segment, configure `mapped-json` with `membership.objectNamePattern` instead of `segmentIdsPath`. This is a Go regular expression with exactly one capture group identifying the segment from the filename. For example:

```json theme={null}
{
  "identity": { "path": "/customerId" },
  "membership": { "objectNamePattern": "^segment-(.+)\\.jsonl$" }
}
```

Use that object as the provider's `mapping`. A file named `segment-seg-gold.jsonl` containing records such as `{"customerId":"customer-001"}` then replaces membership for `seg-gold` only. Other segments remain unchanged. Preserve this naming convention across exports and uploads.

Schedule exports more frequently than `membershipTtlDays`. For ordered exports, an optional `mapping.qualifiedAtPath` points to an RFC3339 timestamp in each record; the latest timestamp becomes the export time. Without one, the object's last-modified time is used. An older export is rejected rather than replacing a newer accepted snapshot.

## 3. Verify the first delivery

After the CDP completes an object, list the provider's reports:

```bash theme={null}
curl "$ACI_API_URL/v1/audience/providers/customer-cdp/imports" \
  --header "Authorization: Bearer $ACI_API_TOKEN"
```

The response contains an `imports` array, newest first. Find the report for the delivered `objectKey` and check:

* `outcome` is `accepted`;
* counts reflect the expected identities and memberships;
* `discovered` contains the expected unmapped segment IDs, if any; and
* there are no unexpected skipped identities or diagnostics.

Delivery into S3 alone does not prove successful import. A schema mismatch or malformed record rejects the whole file. A repeated accepted file with identical content is deduplicated. Check the report before changing mappings or testing a visitor.

## 4. Verify delivery and experiments

Follow [Use the audience in an experience](https://docs.gradial.com/aci/personalization/external-audiences.md#4-use-the-audience-in-an-experience) and [Restrict an experiment to this audience](https://docs.gradial.com/aci/personalization/external-audiences.md#5-restrict-an-experiment-to-this-audience). A new membership export does not require republishing unchanged content; new provider declarations or audience mappings do.

## Troubleshoot

| Symptom | Check |
| - | - |
| No report | Correct bucket and exact prefix, completed object, notification delivery, and importer health |
| Provider not enabled | Provider exists and is enabled in the active release for this site |
| `schema-drift` or record diagnostics | Export shape matches the selected format, JSON pointers, and any configured `dumpSchema` |
| `stale-dump` | Export timestamp is newer than the latest accepted snapshot |
| Accepted import but no targeting | Enabled audience mapping, exact identity value and namespace, consent, active release with external delivery, and unexpired membership |
| Membership disappears after another file | Complete-provider snapshots were split across objects; use one complete snapshot or a segment-specific filename mapping |

Keep source exports within the agreed retention policy. The drop zone has its own lifecycle, and re-import is possible only while the original source object remains available.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.