Our API allows you to create a pickup location where shipments can be collected. The location can be either a Branch or a Warehouse. This guide explains how to use the createPickupLocation endpoint to add a new pickup location.
Instructions
Step 1: API Endpoint
- To create a pickup location, use the following POST endpoint:
https://api.tryoto.com/rest/v2/createPickupLocation
Step 2: Authorization
- A valid Bearer Token must be included in the request headers for authentication
Step 3: Request Body Parameters
- The request body should be in JSON format and must include at least one date filter.
| Name | Required | Type | Description |
|---|---|---|---|
| name | yes | string | name of the pickup location |
| type | no | string | branch,warehouse. default is warehouse |
| code | yes | string | code of the pickup location |
| mobile | yes | string | mobile number of the pickup location |
| lat | no | number | latitude, *if not exist orders may not assigned to pickupLocations automatically |
| lon | no | number | longitude, * if not exist orders may not assigned to pickupLocations automatically |
| city | yes | string | city name of the pickup location |
| country | yes | string | country ISO2 code "SA","AE" etc. |
| postcode | no | string | postal code of the pickup location |
| address | yes | string | street address of the pickup location |
| contactName | yes | string | if not exists you may not create shipments with some delivery companies |
| contactEmail | yes | string | in format of test@example.com |
| servingRadius | no | number | servin radiu of branch in KM |
| brandName | no | string | store brand name which this location belongs to. |
| status | no | string | status of the pickup location(active, inactive) |
Step 4: Example Request
Below is an example request to create a warehouse:
Using cURL:
curl --location 'https://api.tryoto.com/rest/v2/createPickupLocation' \ --data '{ "type": "warehouse", "code": "code-01", "name": "Location Name", "mobile": "555888777", "address": "Test warehouse 3539, Al Khalidiyyah Al Janubiyyah, Dammam 32225", "contactName": "Test Contact", "contactEmail": "Test Email", "lat": "26.001", "lon": "50.001", "city": "Dammam", "district":"Al Khalidiyyah", "street":"Al Janubiyyah", "state":"Eastern Province", "country":"SA", "postcode": "12345", "servingRadius": "10", "brandName": "Example Seller", "status": "active" }'
Step 5: Example Response
- A successful response will return the newly created pickup location details:
{ "warhouseId": "123", "pickupLocationCode": "code-01", "success": true, "message": "warhouse has been created" }