# Create Location

A location typically represents a location from where you'll be doing inventory movement (transferring inventory from one location to another).

### Endpoint

**POST**

```
https://{accountSlug}.myeshopbox.com/api/v1/party
```

***

### Authentication

This API requires **Bearer Token authentication**.

```
Authorization: Bearer <access_token>
```

***

### Headers

| Header        | Value                   |
| ------------- | ----------------------- |
| Authorization | Bearer `<access_token>` |
| Content-Type  | application/json        |
| Accept        | application/json        |

### Request Body

<table><thead><tr><th>Attribute</th><th width="137.9765625">Type</th><th width="310.5390625">Description</th><th>Mandatory</th></tr></thead><tbody><tr><td>partyName</td><td>string</td><td>Name of the location / party</td><td>Yes</td></tr><tr><td>refPartyId</td><td>string</td><td>External reference ID for the location. Ensure the refPartyId (Location code) is same as the identifier available in your ERP.</td><td>Yes</td></tr><tr><td>companyName</td><td>string</td><td>Company name associated with the location</td><td>Yes</td></tr><tr><td>contactPerson</td><td>string</td><td>Contact person name</td><td>Yes</td></tr><tr><td>primaryPhone</td><td>number</td><td>Primary contact phone number</td><td>Yes</td></tr><tr><td>addressLine1</td><td>string</td><td>Address line 1 of the location</td><td>Yes</td></tr><tr><td>addressLine2</td><td>string</td><td>Address line 2 of the location</td><td>No</td></tr><tr><td>city</td><td>string</td><td>City where the location is situated</td><td>Yes</td></tr><tr><td>pincode</td><td>number</td><td>Pincode / postal code</td><td>Yes</td></tr><tr><td>state</td><td>string</td><td>State name</td><td>Yes</td></tr><tr><td>country</td><td>string</td><td>Country name</td><td>Yes</td></tr><tr><td>gstin</td><td>string</td><td>GSTIN associated with the location</td><td>No</td></tr></tbody></table>

### Sample Request

```bash
curl --location 'https://{accountSlug}.myeshopbox.com/api/v1/party' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "partyName": "Palm Resort Primary Hub",
  "refPartyId": "GZB-01",
  "addressLine1": "Tower E1, Flat 105, Palm Resort",
  "addressLine2": "Raj Nagar Extension",
  "city": "Ghaziabad",
  "pincode": 201017,
  "state": "Uttar Pradesh",
  "country": "India",
  "gstin": "09AAACE4105B1Z5",
  "primaryPhone": 9876543210,
  "contactPerson": "Rajesh Kumar",
  "companyName": "Eshopbox Logistics Pvt Ltd"
}'
```

### Response Codes

| Status Code | Description                             |
| ----------- | --------------------------------------- |
| 200         | Location created successfully           |
| 400         | Invalid request parameters              |
| 401         | Unauthorized – Invalid or missing token |
| 409         | Duplicate location / reference ID       |
| 500         | Internal server error                   |

#### Success Response (200)

```json
{
  "id": "456161",
  "accountId": 1215,
  "partyId": "PRPH017456161",
  "refPartyId": "GZB-01",
  "partyName": "Palm Resort Primary Hub",
  "type": "Supplier",
  "gstin": "09AAACE4105B1Z5",
  "addressLine1": "Tower E1, Flat 105, Palm Resort",
  "addressLine2": "Raj Nagar Extension",
  "city": "Ghaziabad",
  "state": "Uttar Pradesh",
  "pincode": "201017",
  "country": "India",
  "primaryPhone": "9876543210",
  "isDefault": "0",
  "companyName": "Eshopbox Logistics Pvt Ltd",
  "flexStatus": "0",
  "contactPerson": "Rajesh Kumar",
  "fcTraceability": ""
}
```

### Response Attributes

| Attribute     | Type   | Description                                   |
| ------------- | ------ | --------------------------------------------- |
| id            | string | Unique identifier for the location created    |
| accountId     | number | Eshopbox account ID                           |
| partyId       | string | System-generated unique party/location ID     |
| refPartyId    | string | Client-provided reference ID for the location |
| partyName     | string | Name of the location                          |
| gstin         | string | GSTIN associated with the location            |
| addressLine1  | string | Address line 1                                |
| addressLine2  | string | Address line 2                                |
| city          | string | City of the location                          |
| state         | string | State of the location                         |
| pincode       | string | Postal / pincode                              |
| country       | string | Country                                       |
| primaryPhone  | string | Primary contact number                        |
| companyName   | string | Company name associated with the location     |
| contactPerson | string | Contact person name                           |

### Important Notes

* `partyId` is **system-generated** and should be used for all downstream operations.
* `refPartyId` must be **unique per account**.
