API Reference

Customers API

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

Endpoints

POST/customers/{tenantId}
DELETE/customers/{tenantId}/{customerId}

Authentication

x-replenit-auth-keyheader required

Usage

  • • Create new customer records
  • • Update existing customer attributes
  • • Synchronize customer profiles
  • • Update consent and preference fields

Identifiers

  • • At least one of CustomerId or Email required
  • • Matching behavior depends on tenant config

Response

Returns the number of processed records

Endpoints

POST/customers/{tenantId}
DELETE/customers/{tenantId}/{customerId}

Parameters

ParameterTypeRequiredDescription
tenantIdGUIDYesTenant 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

StatusDescription
400Invalid request payload
404Tenant not found
500Internal server error

Identifier Behavior

Customer matching is determined by the tenant's identifier priority configuration.

Identifier Priority

Priority SettingIdentifier UsedDescription
customeridCustomerIdExternal customer identifier
emailEmailEmail 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.

PII and Data Minimization

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

FieldTypeMax LengthRequiredDescription
CustomerIdstring100ConditionalExternal customer identifier
Emailstring255ConditionalCustomer email address
Namestring100NoFirst name
Surnamestring100NoLast name
Phonestring20NoPhone number
Languagestring10NoLanguage code (BCP 47)
Usernamestring500NoExternal username
EmailOptinbooleanNoEmail consent flag
SmsOptinbooleanNoSMS consent flag
WhatsappOptinbooleanNoWhatsApp consent flag
AppPushOptinbooleanNoApp push consent flag
GdprOptinbooleanNoControls whether the customer record may be processed by Replenit
IsExcludedbooleanNoExclude 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.

  • trueCustomer record is eligible for processing and downstream activation
  • falseCustomer record may be stored but is excluded from processing and activation
  • omittedGDPR opt-in is treated as false by default, and the customer is considered not consented until an explicit opt-in flag is provided

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

Data Completeness & Decision Quality

Replenit's decisioning accuracy improves with broader and richer data across all entities, including users, products, orders, and events.

You are encouraged to send as many fields as possible for every object, as long as the data is:

  • Stable – consistently defined over time
  • Complete – high coverage across records
  • Reliable – not sparsely populated or frequently changing in meaning

While only a subset of fields is required for ingestion, additional attributes directly enhance:

  • Profiling accuracy (user, product, and behavioral)
  • Contextual understanding for decisioning
  • Reasoning quality for all downstream decisions (replenishment, substitution, cross-sell, churn prevention, etc.)

Rule of thumb:

If a field exists, is well-populated, and carries business meaning, it should be sent.

Optional fields never block ingestion, but richer payloads consistently produce better decisions.

Delete Customer

DELETE/customers/{tenantId}/{customerId}

Parameters

ParameterTypeRequired
tenantIdGUIDYes
customerIdstringYes

Success Response

{
  "success": true,
  "message": "Customer removed.",
  "data": {
    "customerId": "C-123",
    "deletedAt": "2024-12-22T14:02:49Z"
  }
}

Error Responses

StatusDescription
400Missing customer identifier
404Tenant or customer not found
500Deletion 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
  }
]

Request Examples

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

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": {}
}

Related Documentation

Need help or have questions?

Our team is ready to assist you. Reach out to us at support@replen.it

Email Support