# Locations

## Get pickup locations

<mark style="color:green;">`POST`</mark> `https://api.zapiet.com/v1.0/pickup/locations`

This endpoint will return an array of eligible pickup locations.

#### Query Parameters

| Name                                   | Type   | Description                                                             |
| -------------------------------------- | ------ | ----------------------------------------------------------------------- |
| page                                   | number | Used for pagination.                                                    |
| limit                                  | number | Number of locations to return in the response. Default 10. Maximum 200. |
| shop<mark style="color:red;">\*</mark> | string | The merchant's myshopify.com store url.                                 |

#### Request Body

| Name           | Type   | Description                                                                                                                                     |
| -------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| geoSearchQuery | string | Returns locations in distance order from the customer. If no value is provided, we will return locations in the order specified within the app. |
| shoppingCart   | string | The contents of the customer's shopping cart. If no value is provided, we will not check inventory levels or product availability.              |

{% tabs %}
{% tab title="200 Locations successfully retrieved." %}

```json
{
	"locations": [{
		"id": 1,
		"external_id": "72950677728",
		"distance": null,
		"company_name": "Zapiet UK",
		"address_line_1": "Buckingham Palace",
		"address_line_2": null,
		"city": "Westminster",
		"postal_code": "SW1A 1AA",
		"region": "London",
		"country": "United Kingdom",
		"latitude": 51.501009,
		"longitude": -0.141588,
		"timezone": "Europe\/London",
		"custom_attribute_1": null,
		"custom_attribute_2": null,
		"custom_attribute_3": null,
		"date_picker_enabled": true,
		"time_picker_enabled": true,
		"opening_hours": {
			"monday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"tuesday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"wednesday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"thursday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"friday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"saturday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"sunday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			}
		},
		"more_information": null,
		"limits_enabled": null
	}],
	"pagination": {
		"total": 1,
		"per_page": 10,
		"current_page": 1,
		"total_pages": 0,
		"last_page": 1,
		"next_page_url": null,
		"prev_page_url": null,
		"from": 1,
		"to": 1
	}
}
```

{% endtab %}
{% endtabs %}

### Pickup available

{% tabs %}
{% tab title="Request" %}

```javascript
{
    "geoSearchQuery": "90210",
    "shoppingCart": [
        {
            "variant_id": 9226255761451,
            "product_id": 852798275627,
            "quantity": 5
        },
        {
            "variant_id": 9226255761452,
            "product_id": 852798275628,
            "quantity": 2
        }
    ]
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
	"locations": [{
		"id": 1,
		"distance": null,
		"company_name": "Zapiet UK",
		"address_line_1": "Buckingham Palace",
		"address_line_2": null,
		"city": "Westminster",
		"postal_code": "SW1A 1AA",
		"region": "London",
		"country": "United Kingdom",
		"latitude": 51.501009,
		"longitude": -0.141588,
		"timezone": "Europe\/London",
		"custom_attribute_1": null,
		"custom_attribute_2": null,
		"custom_attribute_3": null,
		"date_picker_enabled": true,
		"time_picker_enabled": true,
		"opening_hours": {
			"monday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"tuesday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"wednesday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"thursday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"friday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"saturday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			},
			"sunday": {
				"opens": "09:00",
				"closes": "18:00",
				"closed": false
			}
		},
		"more_information": null,
		"limits_enabled": null
	}],
	"pagination": {
		"total": 1,
		"per_page": 10,
		"current_page": 1,
		"total_pages": 0,
		"last_page": 1,
		"next_page_url": null,
		"prev_page_url": null,
		"from": 1,
		"to": 1
	}
}
```

{% endtab %}
{% endtabs %}

### Pickup not available

If no pickup locations are found, we will return an empty array.

```javascript
{
	"locations": []
}
```
