Create Address
This API enables the creation of a new customer address within the system. Customers, including guests, can create addresses using this API. However, please note that listing addresses is restricted to logged-in users.
Endpoint:
api/customer/profile/addresses
HTTP Method:
POST
Customize address fields as required or optional using the Configuration API to suit your needs. This includes details like apartment, building, floor, landmark, and coordinates (latitude and longitude). The coordinates help determine delivery range from the shop, ensuring efficient service.
When the configuration ADD_ADDRESS_CONFIG
for maps is enabled, a map will be displayed in the address form, allowing users to select locations automatically populate latitude and longitude (lat and lng) coordinates. If the configuration is disabled, this feature will not be available,
- Request Body:
Key | Type | Description |
---|---|---|
name | string | The name of the address, which can be "home", "work", or any other custom label |
address | string | The text of the address. |
city_id | integer | The city ID of the address. |
area_id | integer | The area ID of the address. |
district_id | integer | The district ID of the address. |
apartment | string | The apartment number of the address. |
building | string | The building number of the address. |
floor | string | The floor number of the address. |
landmark | string | A nearby landmark for the address. |
lat | string | The latitude coordinate of the address. |
lng | string | The longitude coordinate of the address. |
primary | boolean | A boolean value that indicates whether the address is the primary address for the customer. |
shop_name | string | The name of the shop associated with the address. |
shop_image | string | The Url image of the shop associated with the address. |
attachment_2 | string | The second url attachment of the address. |
attachment_3 | string | The third url attachment of the address. |
contact_number | string | The contact number of the shop. |
bank_account | string | The bank account of the shop. |
commercial_record | string | The commercial record of the shop. |
{
"name": "Home",
"city_id": 10,
"area_id": 334,
"district_id": null,
"address": "test",
"apartment": "10",
"building": "10",
"floor": "10",
"landmark": "test",
"shop_name": null,
"shop_image": null,
"primary": true,
"lat": "30.105444",
"lng": "31.369139"
}
- Success Response:
You can check more details about Address Resource.
{
"code": 200,
"data": {
//...
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..",
"addresses": [
{
"id": 49124,
"name": "Home",
"address": "test address",
"apartment": "1",
"building": "10",
"landmark": null,
"city_id": 10,
"area_id": 125,
"primary": false,
"lat": "30.105444",
"lng": "31.369139",
"district_id": null,
"floor": "1",
"language": "en",
"shop_name": null,
"shop_image": null,
"formatted_address_ar": "مبني 10, دور 1, شارع test address, شقة 1, المعادي, القاهرة",
"formatted_address_en": "building 10, floor 1, address test address, apartment 1, Maadi, Cairo",
//...
"area": {
"id": 125,
"name": "Maadi",
"name_ar": "المعادي",
"city_id": 10,
"active": true,
//...
},
"city": {
"id": 10,
"name": "Cairo",
"name_ar": "القاهرة",
"active": 1,
//...
},
"district": null
},
]
}
}
Check the following section to learn more about the Create Address API Reference