Skip to main content

Importing Recipients and Orders

Import recipients into a group and synchronize their order positions. See the API Explorer for available endpoints and parameters.

Prerequisites​

Connect the customer's account using the Authorization Code flow in the Authentication guide. Request the Recipients scope (oa_receivers) for groups, recipients, attributes, and orders.

1. Prepare a Group and Global Attributes​

Recipients belong to a group. List groups and let the customer choose one, or create a group. Store its group_id for subsequent requests.

Create any global attributes before importing recipients. Attribute names must exist, and their types must match your values. Supported types are text, number, gender, and date.

Use GET /attributes to list global attributes and POST /attributes to create them. Do not pass a group_id when creating an attribute.

2. Import Recipients​

Choose the endpoint that matches your synchronization strategy:

EndpointBehavior
POST /groups/{group_id}/receivers/upsertCreate a recipient if its email is new to the group; otherwise update it.
POST /groups/{group_id}/receivers/upsertplusUpsert recipients and add or remove tags. It can also increment or decrement numeric global attributes.
POST /groups/{group_id}/receivers/insertInsert new recipients; do not use for updating existing data.
PUT /groups/{group_id}/receivers/updateUpdate existing recipients; unknown recipients are skipped.
Batch size

For large imports, use batches of around 500 recipients. This is a practical starting point: smaller requests are easier to monitor and retry, and less likely to time out.

Track each recipient against its source record and save the per-recipient results after each response so the import can resume safely.

This example creates a new, inactive recipient. It assumes firstname is a global attribute.

POST https://rest.cleverreach.com/v3/groups/{group_id}/receivers/upsert
Authorization: Bearer <access_token>
Content-Type: application/json

[
{
"email": "alex@example.org",
"source": "My Shop",
"registered": 1700000000,
"activated": 0,
"global_attributes": {
"firstname": "Alex"
},
"tags": ["shop.customer"]
}
]
Set recipient status deliberately

For a new recipient awaiting confirmation, send registered with a Unix timestamp and activated: 0, then follow the Double Opt-In guide. An activation timestamp in activated activates the recipient immediately.

If you omit registered, activated, and deactivated, a new recipient can be created as active. For existing recipients, omit status fields unless you intend to change the status. In particular, deactivated: 0 can reactivate a recipient.

3. Import Order Positions​

An order is stored as one or more positions associated with a recipient:

MethodEndpointUse
Batchorders array in a recipient upsertImport order positions together with recipient data.
Single positionPOST /receivers/{pool_id}/orders or POST /groups/{group_id}/receivers/{pool_id}/ordersAdd an order position for an existing recipient.

{pool_id} is the recipient ID or email address. To read order positions, use the corresponding global or group-specific GET endpoint.

Add an orders array to a recipient object in the upsert request:

{
"email": "alex@example.org",
"orders": [
{
"order_id": "shop-order-123",
"product": "Example product",
"product_id": "sku-456",
"price": 9.99,
"quantity": 2,
"currency": "EUR",
"stamp": 1700000000,
"source": "My Shop"
}
]
}
FieldRequiredDescription
order_idYesYour external order ID. Update and delete endpoints use the API's internal ID.
productYesProduct name.
product_idNoYour product or SKU ID.
priceNoPrice per item; defaults to 0.
quantityNoNumber of items; defaults to 1.
currencyNoCurrency code; defaults to EUR.
stampNoOrder time as a Unix timestamp; defaults to the current time.
mailing_idNoMailing ID for conversion tracking.
sourceNoShop or other source name.

4. Check Results and Synchronize​

Batches can partially succeed. Inspect each recipient's result, including any log entries, and retry only entries reported as failed after correcting their data. If a timeout leaves the outcome unclear, reconcile the affected data before resending it. The API does not guarantee duplicate prevention for order positions, so do not blindly retry uncertain order imports.

Read recipient data with GET /groups/{group_id}/receivers or GET /groups/{group_id}/receivers/{pool_id}. The list endpoint supports status, email, and ID filters, and uses zero-based page and pagesize pagination. For large lists, use last_id to fetch recipients with a higher ID, ordered by ID; page is ignored in this mode. Continue with the last ID returned until the response is empty.

Optional: Webhooks​

Subscribe to recipient events to learn about changes made in CleverReach. Webhook registration requires the Webhook scope (oa_webhooks); recipient API calls still require oa_receivers. See Configure Webhooks.