The User Data API allows you to create, update, and manage user information efficiently. Depending on your integration, this API supports both marketing automation platforms and direct user data management.
Overview #
If your organization uses supported marketing automation platforms such as Acoustic, Adobe Experience Cloud, Bloomreach, Braze, CleverTap, Cordial, Emarsys, Insider, Klaviyo, or Salesforce Marketing Cloud, replenishment reminders will be delivered through these platforms. In such cases, only the userId
field needs to be sent to Replenit. These platforms manage Personally Identifiable Information (PII) and sensitive data and Replenit will not manage any PII user data.
For organizations not using these platforms, optional fields like email
and phone
should be included alongside other mandatory fields.
Endpoints #
Method | Endpoint | Description |
---|---|---|
POST | /users/{clientId}/upsert | Adds or updates a single user. |
POST | /users/{clientId}/upsert-many | Adds or updates multiple users in bulk. |
PUT | /users/{clientId}/update-user-email | Updates the email address of a user. |
PUT | /users/{clientId}/update-user-id | Updates the user ID for a user. |
DELETE | /users/{clientId}?identifier={identifier} | Deletes a user by their identifier. |
Field Descriptions #
Identifiers (Object) #
Field | Type | Mandatory | Description |
---|---|---|---|
userId | String | Yes | Unique identifier for the user. Required for all operations. |
email | String | No | Optional secondary identifier. Only include if PII is not managed by a supported marketing automation platform. |
Attributes (Object) #
Field | Type | Mandatory | Description |
---|---|---|---|
phone | String | No | Optional attribute. Only include if PII is not managed by a supported marketing automation platform. |
name | String | No | Optional attribute. Only include if PII is not managed by a supported marketing automation platform. |
surname | String | No | Optional attribute. Only include if PII is not managed by a supported marketing automation platform. |
emailOptin | Boolean | No | Optional attribute. Only include if PII is not managed by a supported marketing automation platform. |
smsOptin | Boolean | No | Optional attribute. Only include if PII is not managed by a supported marketing automation platform. |
language | String | Yes | Preferred language of the user. Use locale-specific codes (e.g., “US_en”). |
Sample Payloads #
1. User Upsert (Single)
If Using a Supported Marketing Automation Platform (only userId
required):
{
"identifiers": {
"userId": "U123456"
},
"attributes": {
"language": "US_en"
}
}
If Not Using a Supported Marketing Automation Platform (additional fields included):
{
"identifiers": {
"userId": "U123456",
"email": "[email protected]"
},
"attributes": {
"phone": "+123456789",
"name": "John",
"surname": "Doe",
"emailOptin": true,
"smsOptin": false,
"language": "US_en"
}
}
2. Bulk Upsert (Multiple Users)
[
{
"identifiers": {
"userId": "U123456",
"email": "[email protected]"
},
"attributes": {
"phone": "+123456789",
"name": "Alice",
"surname": "Smith",
"emailOptin": true,
"smsOptin": false,
"language"</span: "US_en"
}
},
{
"identifiers": {
"userId": "U123456"
},
"attributes": {
"phone": "+1234567890",
"name": "Bob",
"surname": "Brown",
"emailOptin": false,
"smsOptin": true,
"language"</span: "FR_fr"
}
}
]
3. Update User Email
{
"email": "[email protected]"
}
4. Update User ID
{
"userId": "U123456"
}
5. Delete a User
By UserId:
DELETE /users/{clientId}?identifier=U123456
By Email:
DELETE /users/{clientId}[email protected]
Key Notes #
- Replenishment Delivery via Supported Marketing Automation Platforms
If using platforms like Acoustic, Adobe Experience Cloud, Braze, or Salesforce Marketing Cloud, only the
userId
field is required. Replenit maps users dynamically through the platform. - Optional Fields for Non-Marketing Automation Users
For organizations not using supported marketing automation platforms, additional fields (email, phone, name, etc.) can be included to enhance personalization. Ensure sensitive data is encrypted during transit and storage.
- Primary Identifier
The
userId
field is always mandatory and serves as the unique identifier within Replenit.
Retry Mechanism #
For all API operations, implement a retry mechanism to handle transient failures, such as network interruptions or server errors (e.g., HTTP 500). Use an exponential backoff strategy with a maximum of 5 retries to minimize the impact of repeated requests.
Example Retry Logic:
- Retry after 1 second for the first failure.
- Double the retry delay (2, 4, 8 seconds) for subsequent failures.
- Stop retries after 5 attempts or upon a successful request.
Ensure Complete User Data #
Whenever a user is added or updated, ensure all relevant fields (both mandatory and optional) are passed in the payload. Missing fields may result in incomplete or incorrect data processing.
For example, always include:
userId
language
- Optional fields like
email
,phone
,name
,surname
,emailOptin
, andsmsOptin
, if available.
This ensures seamless integration and avoids errors in downstream processes.
Error Handling #
Error Code | Description |
---|---|
400 | Bad Request – Invalid or missing parameters. |
401 | Unauthorized – Invalid API key or token. |
404 | Not Found – User or resource not found. |
500 | Internal Server Error – Unexpected error. |
Best Practices #
- Batch Updates: Use the
/upsert-many
endpoint for bulk updates to optimize performance. - Validation: Validate input fields (e.g., email format, phone number format) before sending requests.
- Retry Mechanism: Implement an exponential backoff strategy for retries.
- Ensure Data Completeness: Always pass all relevant fields in the payload for accuracy.