> 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/add-or-edit-a-party.md).

# Add or Edit a Party

Adds a new **customer or supplier**, or edits an existing one, in a single call. It takes exactly the same request as [Create or Update a Party](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/create-or-update-a-party.md) and works the same way.

### **Endpoint**

| Name          | Detail                                   |
| ------------- | ---------------------------------------- |
| Address       | `https://your-server/api/AddOrEditParty` |
| 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).

### **Request fields**

The same fields as [Create or Update a Party](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/create-or-update-a-party.md) – `Account_Name`, `Account_Type`, `User_Code`, `Cust_Sup_Details` and so on, with the same meaning.

### **Rules Logic ERP applies**

* The same rules as [Create or Update a Party](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/create-or-update-a-party.md): a party is created, or an existing customer or supplier found by its party code (or, without a code, by its name and city) is edited. See that page for how a party is matched and what an edit changes.
* The licence that covers `SaveParty` also covers this endpoint.

### **Example request**

The same request as for `SaveParty`, for example:

```json
{
  "Account_Name": "BALAJI FABRICS",
  "Account_Type": "CU",
  "User_Code": "C2051",
  "Cust_Sup_Details": {
    "First_CityName": "AMRITSAR",
    "Mobile_No": "9876509999"
  }
}
```

### **Response**

The same response as [Create or Update a Party](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/create-or-update-a-party.md): `AccountName`, `AccountCode`, `Status`, `Message` (`Success` when saved), `LastSavedCode` and `request_ID`.

### **Example response**

```json
{
  "AccountName": "BALAJI FABRICS                -AMRITSAR",
  "AccountCode": "C2051",
  "Status": true,
  "Message": "Success",
  "LastSavedCode": 1187,
  "request_ID": "3b9e0c47-58a2-4d7e-9f1a-6c2e8d41b0f5"
}
```

### **Messages you may see**

The same messages as [Create or Update a Party](https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/api-documentation/masters/push/create-or-update-a-party.md). A request your licence does not cover gets a licence message, as described 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).


---

# 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/add-or-edit-a-party.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.
