Skip to main content

Importing Receivers and Orders

Import receivers 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, receivers, attributes, and orders.

1. Prepare a Group and Global Attributes​

Receivers 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 receivers. 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 Receivers​

Choose the endpoint that matches your synchronization strategy:

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

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

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

This example creates a new, inactive receiver. 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 receiver status deliberately

For a new receiver 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 receiver immediately.

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

3. Import Order Positions​

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

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

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

Add an orders array to a receiver 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 receiver'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 receiver 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 receivers 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 receiver events to learn about changes made in CleverReach. Webhook registration requires the Webhook scope (oa_webhooks); receiver API calls still require oa_receivers. See Configure Webhooks.