Add/Update Customer Preferences

Preferences are custom fields created under the preferences category which helps in capturing specific interests of a customer. Example: favorite color, favorite brand. This API allows you to set or update preferences of a customer.

Example request

curl --location 'https://eu.api.capillarytech.com/v1.1/customer/preferences?format=json' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'accept: application/json' \
--data-raw '{
    "root": {
        "customer": [
            {
                "mobile": "7744876415",
                "email": "[email protected]",
                
                
                "store": {
                    "code": "doc123",
                    "id": "75152715"
                } 
               
            }
        ]
    }
}'

Request Body Parameters

Field

Type

Required

Description

root

object

Yes

Root object containing customer data.

  • customer

array

Yes

Array of customer objects. At least one customer object is required.

  • mobile

string

Conditional

Customer's mobile number. Conditionally required Customer's mobile number. At least one identifier among mobile, email, external_id, or user_id should be provided.

  • email

string

Conditional

Customer's email address.

  • external_id

string

Conditional

External identifier for the customer (optional).

  • user_id

string

Conditional

Unique user ID for the customer (optional).

  • store

object

Optional

Store details object.

-- code

string

Optional

Store code to which the customer belongs.

-- id

string

Optional

Store ID. Unique identifier for the store associated with the customer. Pass the internal store ID configured in your system.

  • custom_fields

object

Optional

Object containing custom field data (optional).

-- field

array

Optional

Array of custom field objects. Each defines additional attribute information.

--- name

string

Yes

Name of the custom field. (if custom_fields.field provided) Preference/attribute name (e.g., "Favorite Brand").

--- value

string

Yes

Value for the custom field. Write string values directly (e.g., "Blue") or pass JSON array as a string if multiple values are needed (e.g., "[\"puma\", \"nike\"]"). (if custom_fields.field provided) Preference/attribute value can be a simple string or a serialized list (e.g., ["puma"]).

Example response

{
    "response": {
        "status": {
            "success": "false",
            "code": 500,
            "message": "All requests have failed due to errors"
        },
        "customer": [
            {
                "mobile": "917744876415",
                "email": "[email protected]",
                "external_id": "",
                "store": {
                    "status": "SUCCESS",
                    "id": "75152715",
                    "code": "doc123",
                    "name": "DocStore"
                },
                "custom_fields": {
                    "field": []
                },
                "item_status": {
                    "success": "false",
                    "code": 999999,
                    "message": "",
                    "warnings": {}
                }
            }
        ]
    }
}

API Specific Error Code

Error CodeDescriptionReason
999999Unexpected server error.Returned when an unhandled or unknown error occurs during request processing. Used as a fallback for unexpected failures.
400Bad request.Triggered when required fields are missing or request body is malformed.
401Unauthorized.Authentication failed or missing authorization header.
403Forbidden.User does not have permission to perform this operation.
404Customer not found.Passed identifier (e.g., mobile, email) does not match any customer record.
409Conflict.Duplicate or conflicting data detected in the request.
422Unprocessable entity.Input is semantically incorrect (e.g., invalid email format, unsupported store code).
500Internal server error.Server encountered an error while processing the request.
Language
Credentials
Basic
base64
:
URL
Click Try It! to start a request and see the response here!