Location API Reference
Overview
The Location API allows partners to manage locations (warehouse and store) in the BebasKirim platform. You can create, update, list, and view location details.
Authentication
All API requests require authentication using API key and tenant identification:
- Authorization: Bearer token authentication
- X-Tenant-Id: Your tenant identifier
bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Tenant-Id: YOUR_TENANT_ID" \
https://open.bebaskirim.com/api/partner/v1/locationsBase URL
- Sandbox:
https://open.bebaskirim.com - Production:
https://api.bebaskirim.com
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/partner/v1/locations | List locations |
| GET | /api/partner/v1/locations/{id} | Get location detail |
| POST | /api/partner/v1/locations | Create new location |
| PUT | /api/partner/v1/locations/{id} | Update location |
1. List Locations
Endpoint: GET /api/partner/v1/locations
Request Headers
- Authorization: Bearer token (required)
- X-Tenant-Id: Tenant identifier (required)
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| page | integer | No | Page number (default: 1) |
| per_page | integer | No | Items per page (default: 10, max: 100) |
| status | string | No | Filter by status: active, inactive |
| type | string | No | Filter by type: store, warehouse, office, etc |
| search | string | No | Search by name or code |
Response
json
{
"status": "success",
"data": {
"locations": [
{
"location_id": 1,
"name": "Warehouse A",
"code": "WH-001",
"type": "warehouse",
"address": "Jl. Warehouse A No. 123, Jakarta",
"city": "Jakarta",
"state": "DKI Jakarta",
"zip": "12345",
"country": "Indonesia",
"status": "active",
"is_default": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
],
"pagination": {
"current_page": 1,
"per_page": 10,
"total": 25,
"last_page": 3
}
}
}Example Request
bash
curl -X GET "https://open.bebaskirim.com/api/partner/v1/locations?page=1&per_page=10&status=active" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Tenant-Id: YOUR_TENANT_ID"2. Get Location Detail
Endpoint: GET /api/partner/v1/locations/{id}
Request Headers
- Authorization: Bearer token (required)
- X-Tenant-Id: Tenant identifier (required)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | Location ID |
Response
json
{
"status": "success",
"data": {
"location": {
"location_id": 1,
"name": "Warehouse A",
"code": "WH-001",
"type": "warehouse",
"address": "Jl. Warehouse A No. 123, Jakarta",
"city": "Jakarta",
"state": "DKI Jakarta",
"zip": "12345",
"country": "Indonesia",
"status": "active",
"is_default": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
}Example Request
bash
curl -X GET https://open.bebaskirim.com/api/partner/v1/locations/1 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Tenant-Id: YOUR_TENANT_ID"3. Create Location
Endpoint: POST /api/partner/v1/locations
Request Headers
- Authorization: Bearer token (required)
- X-Tenant-Id: Tenant identifier (required)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Location name (max 100 characters) |
| code | string | Yes | Unique location code per tenant (max 40 characters) |
| type | string | Yes | Location type (warehouse, fulfillment) |
| status | string | Yes | Location status (active, inactive) |
| address | string | Yes | Full address (max 255 characters) |
| city | string | Yes | City name (max 255 characters) |
| state | string | Yes | State/Province name (max 255 characters) |
| zip | string | Yes | Postal/ZIP code (max 10 characters) |
| country | string | Yes | Country name (max 100 characters) |
| subdistrict | string | Yes | Subdistrict name (max 100 characters) |
| district | string | Yes | District name (max 100 characters) |
| pic_name | string | Yes | Person in charge name (max 100 characters) |
| phone | string | Yes | Contact phone number (max 15 characters) |
| latitude | string | No | Latitude coordinate (max 20 characters) |
| longitude | string | No | Longitude coordinate (max 20 characters) |
| is_default | boolean | No | Mark location as default. Only one default location is allowed per tenant. |
| is_pickup | boolean | No | Mark location as pickup point |
| is_return | boolean | No | Mark location as return point |
| origin_code | string | No | Origin code identifier (max 50 characters) |
Request Body
json
{
"name": "Warehouse A",
"code": "WH-001",
"type": "warehouse",
"address": "Jl. Warehouse A No. 123, Jakarta",
"city": "Jakarta",
"state": "DKI Jakarta",
"zip": "12345",
"country": "Indonesia",
"status": "active",
"is_default": true
}Response
json
{
"status": "success",
"data": {
"location": {
"location_id": 1,
"name": "Warehouse A",
"code": "WH-001",
"type": "warehouse",
"address": "Jl. Warehouse A No. 123, Jakarta",
"city": "Jakarta",
"state": "DKI Jakarta",
"zip": "12345",
"country": "Indonesia",
"status": "active",
"is_default": true,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
}
}Example Request
bash
curl -X POST https://open.bebaskirim.com/api/partner/v1/locations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Tenant-Id: YOUR_TENANT_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "Warehouse A",
"code": "WH-001",
"type": "warehouse",
"address": "Jl. Warehouse A No. 123, Jakarta",
"city": "Jakarta",
"state": "DKI Jakarta",
"zip": "12345",
"country": "Indonesia",
"status": "active",
"is_default": true
}'4. Update Location
Endpoint: PUT /api/partner/v1/locations/{id}
Request Headers
- Authorization: Bearer token (required)
- X-Tenant-Id: Tenant identifier (required)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Location name (max 100 characters) |
| type | string | Yes | Location type (warehouse, fulfillment) |
| status | string | Yes | Location status (active, inactive) |
| address | string | Yes | Full address (max 255 characters) |
| city | string | Yes | City name (max 255 characters) |
| state | string | Yes | State/Province name (max 255 characters) |
| zip | string | Yes | Postal/ZIP code (max 10 characters) |
| country | string | Yes | Country name (max 100 characters) |
| subdistrict | string | Yes | Subdistrict name (max 100 characters) |
| district | string | Yes | District name (max 100 characters) |
| pic_name | string | Yes | Person in charge name (max 100 characters) |
| phone | string | Yes | Contact phone number (max 15 characters) |
| latitude | string | No | Latitude coordinate (max 20 characters) |
| longitude | string | No | Longitude coordinate (max 20 characters) |
| is_default | boolean | No | Mark location as default. Only one default location is allowed per tenant. |
| is_pickup | boolean | No | Mark location as pickup point |
| is_return | boolean | No | Mark location as return point |
| origin_code | string | No | Origin code identifier (max 50 characters) |
Request Body
json
{
"name": "Warehouse A Updated",
"code": "WH-001",
"type": "warehouse",
"address": "Jl. Warehouse A No. 123, Jakarta",
"city": "Jakarta",
"state": "DKI Jakarta",
"zip": "12345",
"country": "Indonesia",
"status": "active",
"is_default": false
}Response
json
{
"status": "success",
"data": {
"location": {
"location_id": 1,
"name": "Warehouse A Updated",
"code": "WH-001",
"type": "warehouse",
"address": "Jl. Warehouse A No. 123, Jakarta",
"city": "Jakarta",
"state": "DKI Jakarta",
"zip": "12345",
"country": "Indonesia",
"status": "active",
"is_default": false,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-16T09:00:00Z"
}
}
}Example Request
bash
curl -X PUT https://open.bebaskirim.com/api/partner/v1/locations/1 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "X-Tenant-Id: YOUR_TENANT_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "Warehouse A Updated",
"code": "WH-001",
"type": "warehouse",
"address": "Jl. Warehouse A No. 123, Jakarta",
"city": "Jakarta",
"state": "DKI Jakarta",
"zip": "12345",
"country": "Indonesia",
"status": "active",
"is_default": false
}'Status Codes
| Status | Description |
|---|---|
| active | Location is active and usable |
| inactive | Location is inactive |