> For the complete documentation index, see [llms.txt](https://kb.logicerp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/update-retail-customer.md).

# Update Retail Customer

Changes the details of a **retail customer** who already exists in Logic ERP: name, e-mail address, address, birth date, GST details, customer groups and a few other fields. The customer is found by **membership number** or, if you do not send one, by **mobile number**. Only the fields you fill are changed. To register a new customer, use [Create Retail Customer](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/create-retail-customer.md).

### **Endpoint**

| Name          | Detail                                         |
| ------------- | ---------------------------------------------- |
| Address       | `https://your-server/api/UpdateRetailCustomer` |
| Method        | `POST`                                         |
| Authorization | Basic Auth                                     |

The response and the common messages are explained in [How Every API Call Works](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/how-every-api-call-works.md). You can read the customer back with [Get Retail Customers](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/pull/get-retail-customers.md).

### **Request fields**

The request has the same fields as Create Retail Customer, but most of them work differently here. Field names are not case-sensitive.

**Fields that find the customer**

| Field               | Type   | Required                                 | Default | Meaning                                                                                                                                                                          |
| ------------------- | ------ | ---------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Membership_Number` | number | One of `Membership_Number` / `Mobile_No` | `0`     | The membership number within the series, for example `1052` for `RCU1052`. When above `0`, the customer is found by series and number, and `Mobile_No` is not used to find them. |
| `MemberShip_Series` | text   | With `Membership_Number`                 | empty   | The membership series, for example `"RCU"`. Spaces around it are ignored, and capitals do not matter.                                                                            |
| `Mobile_No`         | text   | One of `Membership_Number` / `Mobile_No` | empty   | Used to find the customer when `Membership_Number` is `0` or left out. Spaces before and after are ignored; otherwise it must match the stored mobile number exactly.            |

**Fields that are changed when filled**

An empty or missing value leaves the stored value as it is.

| Field                                                      | Type | Meaning                                                                                                                                                          |
| ---------------------------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `First_Name`, `Middle_Name`, `Last_Name`                   | text | Customer's name.                                                                                                                                                 |
| `EMail_ID`                                                 | text | E-mail address.                                                                                                                                                  |
| `Birth_Date`                                               | date | Date of birth, `yyyy-MM-dd`. Changed only when it is a valid date.                                                                                               |
| `House_No`                                                 | text | House or shop number. See the rules.                                                                                                                             |
| `Location_Name`, `City_Name`, `State_Name`, `Country_Name` | text | Area, city, state and country. See the rules.                                                                                                                    |
| `Pin_Code`                                                 | text | PIN code.                                                                                                                                                        |
| `Address_2`, `Address_3`                                   | text | Address lines – see the known issue about `Address_1`.                                                                                                           |
| `Spouse_Name`                                              | text | Spouse's name.                                                                                                                                                   |
| `Shoes_Size`                                               | text | Shoe size.                                                                                                                                                       |
| `Remarks`                                                  | text | Remarks.                                                                                                                                                         |
| `Discount_Card_No`                                         | text | Discount card number, kept as text.                                                                                                                              |
| `Gst_Number`                                               | text | GSTIN.                                                                                                                                                           |
| `Gst_State_Code`                                           | text | GST state code. Ignored when the customer has a GST number – see the rules.                                                                                      |
| `Group_Name_1` … `Group_Name_5`                            | text | Retail customer group at levels 1 to 5, by name. A group that does not exist is created. Send `"(NIL)"` to **remove** the customer from the group at that level. |
| `Kid_1_Name`, `Kid_2_Name`                                 | text | Child's name.                                                                                                                                                    |
| `DisplayError`                                             | text | `"1"` = when the request fails, `Message` holds the full technical detail. Use only while testing.                                                               |

**Fields that are ignored here:** `Mobile_No` (it cannot be changed), `MemberShip_Series` and `Membership_Number` (they cannot be changed), `Title`, `Gender`, `Marital_Status`, `Age`, `Anniversary_Date`, `Spouse_Birthdate`, `Kid_1_DOB`, `Kid_2_DOB`, `Branch_Code` and `Branch_Name`. To change these, edit the customer in Logic ERP.

> **Known issue – `Address_1` is not saved, and the other address lines move up.** `Address_1` is dropped. `Address_2` changes the customer's first address line and `Address_3` the second – the lines Get Retail Customers returns as `Address_1` and `Address_2`. Until this is fixed, send the first line in `Address_2` and the second in `Address_3`.

### **Rules Logic ERP applies**

* **Finding the customer.**
  * With `Membership_Number` above `0`: the customer with that series and number. If none, `Unable to found Customer against Membership Number : …` – the membership number and series you sent follow.
  * Otherwise: a customer whose mobile number is `Mobile_No`. One mobile number can belong to more than one customer; in that case the one with the lowest `RCU_Code` is updated. Use the membership number whenever you have it.
  * A customer found this way who has no membership number is refused with `Customer has no Membership Number. Please update this customer in Logic ERP.`
* **Mobile number and membership number never change.** There is no way to change a customer's mobile number through the API.
* **House number.** If another customer in the same area and city already has the new house number, the change is dropped silently and the old house number is kept.
* **Main address line.** Logic ERP rebuilds the customer's main address line from house number, area, city, state and country, using the names you sent where you sent them.
* **GST.** When the customer has a GST number (sent now or already stored), the GST state code is set from its first two characters, and the customer's linked customer account in Logic ERP is created or updated.
* **Loyalty points.** If your loyalty setup gives points for enrolling and this customer has not yet received them, they are added now. Depending on the setup, points for giving certain details may also be added if the customer has not received them yet.
* **Central customer database.** If your Logic ERP shares retail customers through a central customer database, the change is saved there too, and `Mobile_No` or `EMail_ID` may be required by that setup.
* The update is all-or-nothing, except that new customer groups are kept even if the update then fails. Branches and financial years do not apply.
* **Changing the city, state, country or area.** A new `City_Name`, `State_Name`, `Country_Name` or `Location_Name` moves the customer to it; a name that does not exist yet is created, as on Create Retail Customer.

> **Known issue – a new city keeps the old area.** When you send a new `City_Name` without `Location_Name`, the customer keeps its old area. Send `Location_Name` together with a new city.

### **Example request**

Change the e-mail address and add the customer to a level-2 group, finding the customer by membership number:

```json
{
  "MemberShip_Series": "RCU",
  "Membership_Number": 1052,
  "EMail_ID": "neha.arora@example.in",
  "Address_2": "Opp. Sarabha Nagar Market",
  "Group_Name_2": "WEEKEND SHOPPER"
}
```

The same customer found by mobile number:

```json
{
  "Membership_Number": 0,
  "Mobile_No": "9812345670",
  "EMail_ID": "neha.arora@example.in"
}
```

### **Test it**

Send a request to the Logic ERP **sandbox** (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press **Test it**. This really saves in the sandbox, so use test values like the example. The example updates the sandbox's test customer with membership `APT` `1`.

## Update Retail Customer

> Changes the details of a retail customer who already exists in Logic ERP: name, e-mail address, address, birth date, GST details, customer groups and a few other fields. The customer is found by membership number or, if you do not send one, by mobile number. Only the fields you fill are changed. To register a new customer, use Create Retail Customer.

```json
{"openapi":"3.0.3","info":{"title":"Logic ERP API","version":"1.0"},"tags":[{"name":"Masters - Push"}],"servers":[{"url":"https://demo.logicerp.com/api","description":"Logic ERP sandbox (test company)"}],"security":[{"basicAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"The user name and password of your API site."}}},"paths":{"/UpdateRetailCustomer":{"post":{"tags":["Masters - Push"],"operationId":"UpdateRetailCustomer","summary":"Update Retail Customer","description":"Changes the details of a retail customer who already exists in Logic ERP: name, e-mail address, address, birth date, GST details, customer groups and a few other fields. The customer is found by membership number or, if you do not send one, by mobile number. Only the fields you fill are changed. To register a new customer, use Create Retail Customer.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"MemberShip_Series":{"type":"string","description":"The membership series, for example `\"RCU\"`. Spaces around it are ignored, and capitals do not matter."},"Membership_Number":{"type":"integer","description":"The membership number within the series, for example `1052` for `RCU1052`. When above `0`, the customer is found by series and number, and `Mobile_No` is not used to find them."},"EMail_ID":{"type":"string","description":"E-mail address."},"Address_3":{"type":"string","description":"Address lines – see the known issue about `Address_1`."}}}}}},"responses":{"200":{"description":"Always HTTP 200. Check Status and Message.","content":{"application/json":{"schema":{"type":"object","properties":{"Status":{"type":"boolean","description":"`true` when the customer was updated."},"Message":{"type":"string","description":"Empty when the customer was updated; otherwise the reason."},"LastSavedCode":{"type":"integer","description":"Logic ERP's internal number of the customer that was updated – `RCU_Code` in Get Retail Customers. Check it when you found the customer by mobile number. `0` when the request failed."},"request_ID":{"type":"string","description":"Filled once saving has started; empty when the request was refused before that (no membership or mobile number, customer not found)."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | Meaning for this endpoint                                                                                                                                                              |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Status`        | `true` when the customer was updated.                                                                                                                                                  |
| `Message`       | Empty when the customer was updated; otherwise the reason.                                                                                                                             |
| `LastSavedCode` | Logic ERP's internal number of the customer that was updated – `RCU_Code` in Get Retail Customers. Check it when you found the customer by mobile number. `0` when the request failed. |
| `request_ID`    | Filled once saving has started; empty when the request was refused before that (no membership or mobile number, customer not found).                                                   |

### **Example response**

```json
{
  "Status": true,
  "Message": "",
  "LastSavedCode": 42966,
  "request_ID": "a07d5c3e-91b2-4d8f-b6e1-5f2c9a3d7e14"
}
```

### **Messages you may see**

All with `Status: false`.

| Message                                                                                                                                                                                                                          | Meaning                                                                                                                                           | What to do                                                                                                               |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `Membership Number / Mobile No. Cannnot be blank.Please Check...`                                                                                                                                                                | Neither `Membership_Number` (above `0`) nor `Mobile_No` was sent.                                                                                 | Send one of them.                                                                                                        |
| `Unable to found Customer against Membership Number : …Membership Series :…`                                                                                                                                                     | No customer has that series and number. The number and series you sent appear in place of ….                                                      | Check both, or find the customer by mobile number.                                                                       |
| `Unable to found Customer against Mobile No. : …`                                                                                                                                                                                | No customer has that mobile number.                                                                                                               | Check the number; do not add a country code unless it is stored that way. Use Create Retail Customer for a new customer. |
| `Customer has no Membership Number. Please update this customer in Logic ERP.`                                                                                                                                                   | The customer found by mobile number has no membership number, so it cannot be updated through the API.                                            | Give the customer a membership number in Logic ERP.                                                                      |
| `Unable to save Retail Customer. Please Check...`                                                                                                                                                                                | Logic ERP did not save the change. Nothing was changed (new customer groups are kept).                                                            | Check the request, or ask your Logic ERP support team.                                                                   |
| `Mobile Number cannot be blank...` or `EMail id cannot be blank...`                                                                                                                                                              | Your Logic ERP uses a central customer database that identifies customers by mobile number or e-mail address, and that field is empty.            | Fill the field named.                                                                                                    |
| A message starting `Cannot Open Remote Database`                                                                                                                                                                                 | Logic ERP could not reach the central customer database.                                                                                          | Try again later; if it continues, ask your Logic ERP support team.                                                       |
| A message starting `Error creating customer : ERROR Position : …`                                                                                                                                                                | Saving failed, for example because a text is longer than the field allows. The reason may be followed by technical detail – read the first lines. | Check the lengths given on the Create Retail Customer page.                                                              |
| A message starting `Error creating customer : ERROR Position : …` followed by `Account creation against retail customer -> User Code Already Exists` or `Account creation against retail customer -> Account Name Already Exits` | The customer has a GST number, and the customer account Logic ERP creates or updates clashes with the account of another customer.                | Ask your Logic ERP team to check the existing account.                                                                   |
| A database error                                                                                                                                                                                                                 | The mobile number, membership series, a group name or the house number contains a `'`.                                                            | Send them without quotes.                                                                                                |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/update-retail-customer.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
