Our API offers a specialized endpoint to manage the creation and modification of customer and loyalty data. This endpoint supports a range of updates at the same API call.
It uses the email as the primary identifier of the customer and the feature field to specify which part of the customer's information needs to be updated.
Before you start ¶
This endpoint is part of the Custom API Integration. It only works when the integration is active in JeriCommerce under Settings > Integrations > API, with the Customer feature turned on. Otherwise it answers 403 with API_INTEGRATION_REQUIRED or API_USERS_REQUIRED.
This endpoint is secured by the api-key header. Please review our authentication documentation.
Create and Update ¶
POST https://api.jericommerce.com/v1/programs/{program_slug}/integrations/api
Replace {program_slug} with your real program slug. You can find it in JeriCommerce under Settings > Technical > Program Information.
The request body is an array of objects, so you can send up to 250 customers in a single API call.
Each object has the customer's email, the feature name, which is always users for customer data, and the payload with the information to add or update. If no customer has that email yet, JeriCommerce creates one.
Here is the structure of the JSON:
[
{
"email": "string",
"feature": "users",
"payload": {
"externalCustomerId": "string",
"firstName": "string",
"lastName": "string",
"phone": "string",
"emailVerified": boolean,
"email": "string"
}
}
]
Let's explain the fields of the payload one by one.
email ¶
Only send this field when the customer's email needs to change. Use the current email as the email of the object and the new email inside the payload.
After the change, the next API request should use this new email as the identifier.
externalCustomerId ¶
This is the identifier outside of Jericommerce, normally the identifier from an external database. Is required for each update or creation.
firstName ¶
The customer's first name is displayed as part of their name on the loyalty card. Is a nullable value.
lastName ¶
The customer's last name is displayed as part of their name on the loyalty card. Is a nullable value.
phone ¶
Phone of the customer By default, the value is null. If you don't send any data, the field will not be changed.
emailVerified ¶
The customer's email address has been validated. By default, the value is false. If you want to update it, you can send the correct value. If no change is required, you can avoid sending it.
Response ¶
The items are processed in order, while the request is open. A 201 response with an empty body means every item was saved.
If one item fails, the request stops there and returns the error. The items before it are already saved and the items after it are not processed, so fix the failing item and send the remaining ones again.
Delete Customer ¶
To delete a customer, use the same API endpoint with the DELETE HTTP verb and the customer's email in the email query parameter. Customers are deleted one by one.
DELETE https://api.jericommerce.com/v1/programs/{program_slug}/integrations/api?email={customerEmail}
This deletes the whole customer from JeriCommerce, including their loyalty information, so it cannot be undone. If everything goes well, you will receive a 200 response. If no customer has that email, you will receive a 404 with CUSTOMER_NOT_FOUND.
Errors ¶
| Code | Status | Meaning |
|---|---|---|
API_INTEGRATION_REQUIRED |
403 |
The API integration is not active for this program. |
API_USERS_REQUIRED |
403 |
The Customer feature is turned off in the API integration. |
FEATURE_NOT_ENABLED |
400 |
The feature value is not users or loyalty. |
MAX_OBJECTS_PER_REQUEST_EXCEEDED |
400 |
The array has more than 250 items. |
CUSTOMER_NOT_FOUND |
404 |
DELETE only. No customer has that email. |