Customers
Bulk upsert customer records for a tenant
Overview
The Customers endpoint supports bulk creation and updates of customer records for a tenant.
Each request processes an array of customer objects and applies upsert semantics based on the tenant’s identifier configuration.
This endpoint is used to synchronize customer profiles, preferences, and consent attributes from upstream systems into Replenit.
Quick Reference
Endpoint
| POST /customers/{tenantId} |
Usage
- Create new customer records
- Update existing customer attributes
- Synchronize customer profiles from external systems
- Update consent and preference fields
Identifiers
- At least one of CustomerId or Email must be provided
- Identifier matching behavior depends on tenant configuration
Authentication
- x-replenit-auth-key header required
Response
- Returns the number of processed records
Endpoint
| POST /customers/{tenantId} |
Parameters
| Parameter | Type | Required | Description |
| tenantId | GUID | Yes | Tenant identifier |
Request
- Body: JSON array of UpsertCustomerDto objects
- Content-Type: application/json
Success Response
- Status: 200 OK
- Body: Response envelope containing data.count
Error Responses
| Status | Description |
| 400 | Invalid request payload |
| 404 | Tenant not found |
| 500 | Internal server error |
Identifier Behavior
Customer matching is determined by the tenant’s identifier priority configuration.
Identifier Priority
| Priority Setting | Identifier Used | Description |
| customerid | CustomerId | External customer identifier |
| Email address |
Matching Rules
- If the configured identifier exists, the customer record is updated
- If the configured identifier does not exist, a new customer record is created
- Secondary identifiers may be stored but are not used for matching
Example
| { “CustomerId”: “USER-12345”, “Email”: “customer@example.com”, “Name”: “Jane”, “Surname”: “Doe” } |
Identifier priority can be viewed or modified in the tenant configuration within the Replenit panel.
Identifier Alignment, Usage, and PII Considerations
If CustomerId is used as the primary identifier, the same identifier must be configured as the customer identifier in all downstream systems that consume Replenit data, including marketing automation, CRM, analytics, and activation platforms.
If Email is used as the primary identifier, the same email address must be configured as the customer identifier in downstream systems.
When a stable CustomerId is available and consistently used across downstream systems, email address should not be used as the primary identifier for matching. In this case, email may be provided only when required for downstream communication and should not be relied on for identity resolution.
From a PII and data minimization perspective, Replenit does not require email address to be present when a stable CustomerId is available and used across systems. Where possible, customer records should be ingested using non-PII identifiers.
Inconsistent identifier usage or unnecessary reliance on PII across systems may result in fragmented customer profiles or increased data governance risk.
Request Schema
UpsertCustomerDto
| Field | Type | Max Length | Required | Description |
| CustomerId | string | 100 | Conditional | External customer identifier |
| string | 255 | Conditional | Customer email address | |
| Name | string | 100 | No | First name |
| Surname | string | 100 | No | Last name |
| Phone | string | 20 | No | Phone number |
| Language | string | 10 | No | Language code (BCP 47) |
| Username | string | 500 | No | External username |
| EmailOptin | boolean | – | No | Email consent flag |
| SmsOptin | boolean | – | No | SMS consent flag |
| WhatsappOptin | boolean | – | No | WhatsApp consent flag |
| AppPushOptin | boolean | – | No | App push consent flag |
| GdprOptin | boolean | – | No | Controls whether the customer record may be processed by Replenit |
| IsExcluded | boolean | – | No | Exclude customer from activation |
GDPR Processing Flag
GdprOptin is not technically required for ingestion validation.
GdprOptin is a Replenit-level processing control that determines whether customer data may be processed and used within the platform.
- When GdprOptin is true, the customer record is eligible for processing and downstream activation
- When GdprOptin is false, the customer record may be stored but is excluded from processing and activation
- If omitted, behavior follows the tenant’s default configuration
Replenit does not infer consent. Responsibility for setting the correct value remains with the data source.
Notes
- Consent flags control downstream activation eligibility
- Language must follow IETF BCP 47 format
- Field requirements may vary based on tenant configuration
Delete Customer
| DELETE /customers/{tenantId}/{customerId} |
Parameters
| Parameter | Type | Required |
| tenantId | GUID | Yes |
| customerId | string | Yes |
Success Response
| { “success”: true, “message”: “Customer removed.”, “data”: { “customerId”: “C-123”, “deletedAt”: “2024-12-22T14:02:49Z” } } |
Error Responses
| Status | Description |
| 400 | Missing customer identifier |
| 404 | Tenant or customer not found |
| 500 | Deletion failure |
Examples
Minimal Request
| [ { “CustomerId”: “C-126” } ] |
*This profile will not be processed by Replenit as GDPR Opt-in will be set as false by default
Email-Based Identifier
| [ { “Email”: “customer@example.com”, “Language”: “fr-FR”, “GdprOptin”: true } ] |
Full Payload Example
| [ { “CustomerId”: “C-123”, “Email”: “john.doe@example.com”, “Name”: “John”, “Surname”: “Doe”, “Phone”: “+1-555-123-4567”, “Language”: “en-US”, “Username”: “johndoe”, “EmailOptin”: true, “SmsOptin”: false, “WhatsappOptin”: true, “AppPushOptin”: true, “GdprOptin”: true, “IsExcluded”: false } ] |
cURL
| curl -X POST “https://api.replen.it/customers/{tenantId}” \ -H “Content-Type: application/json” \ -H “x-replenit-auth-key: YOUR_BASE64_ACCESS_KEY” \ -d @customers.json |
Python
| import requests url = “https://api.replen.it/customers/{tenantId}” headers = { “Content-Type”: “application/json”, “x-replenit-auth-key”: “YOUR_BASE64_ACCESS_KEY” } customers = [ { “CustomerId”: “C-123”, “EmailOptin”: True } ] response = requests.post(url, headers=headers, json=customers) print(response.json()) |
Node.js
| const axios = require(‘axios’); axios.post( ‘https://api.replen.it/customers/{tenantId}’, [{ CustomerId: ‘C-123’, EmailOptin: true }], { headers: { ‘x-replenit-auth-key’: ‘YOUR_BASE64_ACCESS_KEY’ } } ); |
Response Examples
Success
| { “success”: true, “message”: “Customers saved.”, “data”: { “count”: 3, “processedAt”: “2024-12-22T14:05:51Z” } } |
Validation Error – Missing Identifier
| { “status”: 400, “errors”: { “”: [ “At least one of the following properties must have a value: CustomerId, Email” ] } } |
Validation Error – Field Length
| { “status”: 400, “errors”: { “[0].CustomerId”: [ “The field CustomerId must be a string with a maximum length of 100.” ] } } |
Tenant Not Found
| { “success”: false, “message”: “Tenant not found.”, “data”: {} } |

