> 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/create-retail-customer.md).

# Create Retail Customer

Registers a new **retail customer** (a shopper or loyalty member) in Logic ERP: name, mobile number, membership number, address, family dates and customer groups. Use it when a customer signs up in your app, website or store system, so that Logic ERP's billing can find them by mobile number or membership number. To change a customer who already exists, use [Update Retail Customer](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/update-retail-customer.md) instead.

### **Endpoint**

| Name          | Detail                                       |
| ------------- | -------------------------------------------- |
| Address       | `https://your-server/api/SaveRetailCustomer` |
| 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 customers 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**

One customer per request. Field names are not case-sensitive. Most text values are saved with spaces trimmed from both ends; area, city, state and country names are saved in capitals. Logic ERP does not check the format of the mobile number, e-mail address or GST number.

| Field                                 | Type   | Required | Default   | Meaning                                                                                                                                                                                                                               |
| ------------------------------------- | ------ | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `MemberShip_Series`                   | text   | Yes      | –         | The membership series, for example `"RCU"`. Up to 8 characters. Any series is accepted; it does not have to exist in Logic ERP already.                                                                                               |
| `Membership_Number`                   | number | No       | `0`       | The membership number within the series. `0` (or left out) = Logic ERP gives the next free number in the series. A number above `0` is used as it is; together with the series it makes the membership number, for example `RCU1052`. |
| `Mobile_No`                           | text   | Yes      | –         | Mobile number, up to 20 characters.                                                                                                                                                                                                   |
| `First_Name`                          | text   | Yes      | –         | First name, up to 50 characters.                                                                                                                                                                                                      |
| `Middle_Name`, `Last_Name`            | text   | No       | empty     | Middle and last name, up to 50 characters each.                                                                                                                                                                                       |
| `Title`                               | text   | No       | empty     | Title, for example `"Mrs."`. Up to 5 characters.                                                                                                                                                                                      |
| `EMail_ID`                            | text   | No       | empty     | E-mail address, up to 50 characters.                                                                                                                                                                                                  |
| `Gender`                              | number | No       | `0`       | `0` = male, `1` = female, `2` = not stated (as shown by Get Retail Customers).                                                                                                                                                        |
| `Marital_Status`                      | number | No       | `0`       | `0` = married, `1` = unmarried, `2` = not stated.                                                                                                                                                                                     |
| `Age`                                 | number | No       | `0`       | Age in years. See the rules for how it is used when no birth date is sent.                                                                                                                                                            |
| `Birth_Date`                          | date   | No       | none      | Date of birth, `yyyy-MM-dd`.                                                                                                                                                                                                          |
| `Anniversary_Date`                    | date   | No       | none      | Wedding anniversary, `yyyy-MM-dd`.                                                                                                                                                                                                    |
| `Spouse_Name`                         | text   | No       | empty     | Spouse's name, up to 50 characters.                                                                                                                                                                                                   |
| `Spouse_Birthdate`                    | date   | No       | none      | Spouse's date of birth, `yyyy-MM-dd`.                                                                                                                                                                                                 |
| `House_No`                            | text   | No       | see rules | House or shop number, up to 100 characters.                                                                                                                                                                                           |
| `Location_Name`                       | text   | No       | empty     | Area or locality, for example `"MODEL TOWN"`.                                                                                                                                                                                         |
| `City_Name`                           | text   | No       | empty     | City.                                                                                                                                                                                                                                 |
| `State_Name`                          | text   | No       | empty     | State.                                                                                                                                                                                                                                |
| `Country_Name`                        | text   | No       | empty     | Country.                                                                                                                                                                                                                              |
| `Pin_Code`                            | text   | No       | empty     | PIN code, up to 10 characters.                                                                                                                                                                                                        |
| `Address_1`, `Address_2`, `Address_3` | text   | No       | empty     | Address lines, up to 250 characters each. See the known issue below.                                                                                                                                                                  |
| `Branch_Code`                         | number | No       | `0`       | Logic ERP's number of the branch the customer belongs to (`0` = none). It is not checked.                                                                                                                                             |
| `Remarks`                             | text   | No       | empty     | Any remarks.                                                                                                                                                                                                                          |
| `Shoes_Size`                          | text   | No       | empty     | Shoe size, up to 20 characters.                                                                                                                                                                                                       |
| `Discount_Card_No`                    | text   | No       | empty     | A discount card number, kept as text on the customer, up to 30 characters. It does not issue or link a discount card.                                                                                                                 |
| `Gst_Number`                          | text   | No       | empty     | The customer's GSTIN, up to 30 characters. See the rules.                                                                                                                                                                             |
| `Gst_State_Code`                      | text   | No       | see rules | GST state code, for example `"03"`.                                                                                                                                                                                                   |
| `Group_Name_1` … `Group_Name_5`       | text   | No       | empty     | The customer's retail customer groups at levels 1 to 5, by name, for example `"GOLD"`. Empty or `"(NIL)"` = no group at that level.                                                                                                   |
| `DisplayError`                        | text   | No       | `"0"`     | `"1"` = when the request fails, `Message` holds the full technical detail. Use only while testing.                                                                                                                                    |

**Ignored field.** `Branch_Name` is accepted but not used.

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

**Children.** `Kid_1_Name` and `Kid_2_Name` (text) and `Kid_1_DOB` and `Kid_2_DOB` (date, `yyyy-MM-dd`) record up to two children of the customer.

### **Rules Logic ERP applies**

* **Duplicates.** A customer is refused with `Customer already exists...` when:

  * you send a `Membership_Number` above `0` and that series and number already belong to a customer, or
  * you send `Membership_Number` `0` and **any** customer already has exactly this mobile number.

  Spaces before and after the mobile number are removed before it is compared and saved.
* **New membership number.** With `Membership_Number` `0`, the customer gets the highest number already used in that series plus 1. The new number is not returned – `LastSavedCode` is Logic ERP's internal customer number. To learn the membership number, call Get Retail Customers with the mobile number.
* **City, state, country and area are created when missing.** Each is looked up by name (in capitals; a city or area name is cut to 30 characters):
  * a **country** or **state** that does not exist is added with that name – so a misspelt state becomes a new state, with no GST state code;
  * a **city** is matched by name only, whatever state it is in; a new city is added under the state you sent;
  * an **area** (`Location_Name`) is matched by name within the city; a new area is added under that city.
* **Customer groups are created when missing.** A `Group_Name_…` that does not exist at that level is added. Groups are added once the request has passed the first checks, and they are kept even if saving the customer then fails.
* **House number.** When `House_No` is empty, Logic ERP stores `Mem No :` followed by the membership number. When another customer in the same area and city already has the same house number, the membership number in brackets is added to it, for example `217(RCU1052 )`.
* **Main address line.** Logic ERP builds the customer's main address itself from house number, area and city, followed by state and country when a city is given. It is cut to 150 characters.
* **Dates** that are empty or not a valid date are saved as blank, without an error. Write dates as `yyyy-MM-dd`.
* **Age without a birth date.** When `Age` is above `0` and `Birth_Date` is left out or `null`, Logic ERP also records an estimated date of birth (today minus the age).
* **GST.** When `Gst_Number` is filled, the GST state code is taken from its first two characters, whatever you send in `Gst_State_Code`. With no GST number and no `Gst_State_Code`, the GST state code of the state is used. A customer with a GST number also gets a linked **customer account** in Logic ERP, named after the customer and coded with the membership number, so GST invoices can be made out to them. If an account linked to another customer already has that code, or the same name in the same city, the whole request fails.
* **Loyalty points.** If your loyalty setup gives points for enrolling, or for giving details such as mobile number, e-mail address, birthday or anniversary, those points are added to the new customer.
* **Central customer database.** If your Logic ERP shares retail customers with other companies through a central customer database (set up by your support team), the customer is also saved there and the new membership number comes from there. Depending on that setup, `EMail_ID` or `Mobile_No` must then be filled.
* The customer is saved as a whole: if anything fails while saving, nothing of the customer is kept (except new customer groups, see above). Branches and financial years do not apply.

> **Known issue – the mobile number is not checked when you send a membership number.** With `Membership_Number` above `0`, a customer is created even if another customer already has the same mobile number. Update Retail Customer and Delete Retail Customer Group Discounts then use the customer with the lowest `RCU_Code`; other look-ups by mobile number (the employee discount endpoints) use one of them, and you cannot choose which. Before creating a customer with your own membership number, check the mobile number with Get Retail Customers.

### **Example request**

```json
{
  "MemberShip_Series": "RCU",
  "Membership_Number": 0,
  "Title": "Mrs.",
  "First_Name": "Neha",
  "Middle_Name": "",
  "Last_Name": "Arora",
  "EMail_ID": "neha.arora@example.com",
  "Mobile_No": "9812345670",
  "Birth_Date": "1991-07-14",
  "Anniversary_Date": "2016-11-26",
  "Gender": 1,
  "Marital_Status": 0,
  "House_No": "217",
  "Location_Name": "MODEL TOWN",
  "City_Name": "LUDHIANA",
  "State_Name": "PUNJAB",
  "Country_Name": "INDIA",
  "Pin_Code": "141002",
  "Address_1": "",
  "Address_2": "Near Gurdwara Sahib",
  "Address_3": "",
  "Branch_Code": 2,
  "Group_Name_1": "GOLD",
  "Gst_Number": ""
}
```

### **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's mobile number is already used in the sandbox, so sending it unchanged answers that the customer already exists; change `Mobile_No` (for example to `9000000005`) to create a new test customer.

## Create Retail Customer

> Registers a new retail customer (a shopper or loyalty member) in Logic ERP: name, mobile number, membership number, address, family dates and customer groups. Use it when a customer signs up in your app, website or store system, so that Logic ERP's billing can find them by mobile number or membership number. To change a customer who already exists, use Update Retail Customer instead.

```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":{"/SaveRetailCustomer":{"post":{"tags":["Masters - Push"],"operationId":"SaveRetailCustomer","summary":"Create Retail Customer","description":"Registers a new retail customer (a shopper or loyalty member) in Logic ERP: name, mobile number, membership number, address, family dates and customer groups. Use it when a customer signs up in your app, website or store system, so that Logic ERP's billing can find them by mobile number or membership number. To change a customer who already exists, use Update Retail Customer instead.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"MemberShip_Series":{"type":"string","description":"The membership series, for example `\"RCU\"`. Up to 8 characters. Any series is accepted; it does not have to exist in Logic ERP already."},"Membership_Number":{"type":"integer","description":"The membership number within the series. `0` (or left out) = Logic ERP gives the next free number in the series. A number above `0` is used as it is; together with the series it makes the membership number, for example `RCU1052`."},"Title":{"type":"string","description":"Title, for example `\"Mrs.\"`. Up to 5 characters."},"First_Name":{"type":"string","description":"First name, up to 50 characters."},"Middle_Name":{"type":"string","description":"Middle and last name, up to 50 characters each."},"Last_Name":{"type":"string","description":"Middle and last name, up to 50 characters each."},"EMail_ID":{"type":"string","description":"E-mail address, up to 50 characters."},"Mobile_No":{"type":"string","description":"Mobile number, up to 20 characters."},"Birth_Date":{"type":"string","description":"Date of birth, `yyyy-MM-dd`."},"Gender":{"type":"integer","description":"`0` = male, `1` = female, `2` = not stated (as shown by Get Retail Customers)."},"Marital_Status":{"type":"integer","description":"`0` = married, `1` = unmarried, `2` = not stated."},"House_No":{"type":"string","description":"House or shop number, up to 100 characters."},"Pin_Code":{"type":"string","description":"PIN code, up to 10 characters."},"Address_1":{"type":"string","description":"Address lines, up to 250 characters each. See the known issue below."},"Address_2":{"type":"string","description":"Address lines, up to 250 characters each. See the known issue below."},"Address_3":{"type":"string","description":"Address lines, up to 250 characters each. See the known issue below."},"Branch_Code":{"type":"integer","description":"Logic ERP's number of the branch the customer belongs to (`0` = none). It is not checked."},"Gst_Number":{"type":"string","description":"The customer's GSTIN, up to 30 characters. See the rules."}}}}}},"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 created."},"Message":{"type":"string","description":"Empty when the customer was created; otherwise the reason."},"LastSavedCode":{"type":"integer","description":"Logic ERP's internal number of the new customer – the same number as `RCU_Code` in Get Retail Customers. It is not the membership number. `0` when the request failed."},"request_ID":{"type":"string","description":"Filled once saving has started; empty when the request was refused by the first checks (missing mobile number, name or series, or a duplicate)."}}}}}},"401":{"description":"No login was sent."}}}}}}
```

### **Response**

| Field           | Meaning for this endpoint                                                                                                                                                  |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Status`        | `true` when the customer was created.                                                                                                                                      |
| `Message`       | Empty when the customer was created; otherwise the reason.                                                                                                                 |
| `LastSavedCode` | Logic ERP's internal number of the new customer – the same number as `RCU_Code` in Get Retail Customers. It is **not** the membership number. `0` when the request failed. |
| `request_ID`    | Filled once saving has started; empty when the request was refused by the first checks (missing mobile number, name or series, or a duplicate).                            |

### **Example response**

```json
{
  "Status": true,
  "Message": "",
  "LastSavedCode": 42966,
  "request_ID": "3b9e6c1d-52a4-4f0e-9d7a-8c1f2e4b6a90"
}
```

### **Messages you may see**

All with `Status: false`.

| Message                                                                                                                                                                                                                          | Meaning                                                                                                                                                | What to do                                                                        |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| `Please Define Mobile No. to Continue...`                                                                                                                                                                                        | `Mobile_No` is missing or empty.                                                                                                                       | Send the mobile number.                                                           |
| `Customer First Name not defined...Please Check..`                                                                                                                                                                               | `First_Name` is missing or blank.                                                                                                                      | Send the first name.                                                              |
| `Please Define Customer Membership Series to Continue...:`                                                                                                                                                                       | `MemberShip_Series` is missing, empty or only spaces.                                                                                                  | Send the series.                                                                  |
| `Customer already exists...`                                                                                                                                                                                                     | The membership number, or (with `Membership_Number` `0`) the mobile number, already belongs to a customer – see the rules.                             | Use Update Retail Customer to change that customer, or check the number you sent. |
| `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 in the table above.                                             |
| `Unable to save Retail Customer. Please Check...`                                                                                                                                                                                | Logic ERP did not save the customer. Nothing was saved (new customer groups are kept, see the rules).                                                  | Check the request, or ask your Logic ERP support team.                            |
| 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 tries to create clashes with the account of another customer (see GST in the rules). | 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/create-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.
