Tenant API Reference
Overview
The Tenant API provides endpoints for managing tenant authorization and retrieving tenant-related information in the BebasKirim platform.
Authentication
All endpoints require API token authentication via the Authorization header:
Authorization: {{auth}}Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/partner/v1/tenants/authorize | Authorize tenant |
| POST | /api/partner/v1/tenants/deauthorize | Deauthorize tenant |
| GET | /api/partner/v1/tenants | Get Connected Tenants |
| GET | /api/partner/v1/tenants/locations | Get tenant locations |
| GET | /api/partner/v1/tenants/available-logistics | Get available logistics |
1. Authorize Tenant
Authorize a tenant for API access with an expiration date.
Endpoint: POST /api/partner/v1/tenants/authorize
Headers:
Authorization: {token}(required)
Request Body:
{
"tenant_id": "string",
"days_connected": "integer",
"installation_type": "string",
}Parameters:
tenant_id(string, required): The unique identifier of the tenant to authorizedays_connected(integer, required): The number of days the tenant has been connected to the appinstallation_type(string, required): The type of installation (e.g., "custom", "marketplace")
Example Request:
curl -X POST {{url}}/api/partner/v1/tenants/authorize \
-H "Authorization: {token}" \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "tenant_123",
"days_connected": 30,
"installation_type": "custom"
}'2. Deauthorize Tenant
Remove authorization for a tenant.
Endpoint: POST /api/partner/v1/tenants/deauthorize
Headers:
Authorization: {token}(required)
Request Body:
{
"tenant_id": "string",
"uninstall_reason": "string"
}Example Request:
curl -X POST {{url}}/api/partner/v1/tenants/deauthorize \
-H "Authorization: {token}"
-d '{
"tenant_id": "tenant_123",
"uninstall_reason": "Tenant is no longer needed"
}'3. Get Tenant List
Retrieve a paginated list of all tenants that connected to the Partner.
Endpoint: GET /api/partner/v1/tenants
Headers:
Authorization: {token}(required)
Query Parameters:
page(integer, optional): Page number for pagination (default: 1)per_page(integer, optional): Number of items per page (default: 10)
Example Request:
curl -X GET "{{url}}/api/partner/tenants?page=1&per_page=10" \
-H "Authorization: {token}"Example Response:
{
"status": 200,
"message": "Ok",
"data": {
"installations": [
{
"partner_id": "68b80d2787d08d24700a1c73",
"tenant_id": "ca539d2f-bc3f-4786-9362-6b1f7d0e8372",
"tenant_type": "live",
"app_id": "68b80d5d87d08d24700a1c74",
"app_key": "9a467c59b19147fab3edb3c8755904e3",
"installation_type": "custom",
"installed_at": "2025-09-09T10:58:52.605000Z",
"days_connected": 60,
"uninstall_at": null,
"uninstall_reason": null,
"updated_at": "2025-09-09T10:58:52.605000Z",
"created_at": "2025-09-09T10:40:40.655000Z",
"id": "68c0042852859572a7019c52"
}
],
"pagination": {
"current_page": 1,
"per_page": 10,
"total": 1,
"last_page": 1,
"from": 1,
"to": 1,
"has_more_pages": false
}
},
"errors": null,
"request_id": "490f1356-84f4-4a68-b161-21e03e7f2a80"
}4. Get Tenant Locations
Retrieve a paginated list of locations for a specific tenant.
Endpoint: GET /api/partner/v1/tenants/locations
Headers:
Authorization: {token}(required)X-Tenant-Id: {tenant_id}(required)
Query Parameters:
page(integer, optional): Page number for pagination (default: 1)per_page(integer, optional): Number of items per page (default: 10)
Example Request:
curl -X GET "{{url}}/api/partner/v1/tenants/locations?page=1&per_page=10" \
-H "Authorization: {token}" \
-H "X-Tenant-Id: 1"Example Response:
{
"status": 200,
"message": "Ok",
"data": {
"locations": [
{
"location_id": 1,
"name": "Warehouse Pusat",
"code": "WH-PUSAT",
"type": "warehouse",
"address": "Jl. Raya No. 1",
"city": "Bandung",
"state": "Jawa Barat",
"zip": "40921",
"subdistrict": "Katapang",
"country": "Indonesia",
"pic_name": "John Doe",
"phone": "081234567890",
"latitude": "-6.175110",
"longitude": "106.865036",
"is_default": true,
"is_pickup": true,
"status": "active",
"origin_code": null,
"created_at": "2025-08-25T03:26:55.000000Z",
"created_by": "system"
}
],
"pagination": {
"current_page": 1,
"per_page": 10,
"total": 1,
"last_page": 1,
"from": 1,
"to": 1,
"has_more_pages": false
}
},
"errors": null,
"request_id": "bec27d35-7c3b-4524-ac58-97a63dec5de7"
}5. Get Tenant Available Logistics
Retrieve a paginated list of available logistics services for a specific tenant.
Endpoint: GET /api/partner/v1/tenants/available-logistics
Headers:
Authorization: {token}(required)X-Tenant-Id: {tenant_id}(required)
Query Parameters:
page(integer, optional): Page number for pagination (default: 1)per_page(integer, optional): Number of items per page (default: 10)
Example Request:
curl -X GET "{{url}}/api/partner/v1/tenants/available-logistics?page=1&per_page=10" \
-H "Authorization: {token}" \
-H "X-Tenant-Id: 1"Example Response:
{
"status": 200,
"message": "Ok",
"data": {
"logistics": [
{
"logistic_preference_id": 7,
"logistic_provider_id": 15,
"available_service_types": {
"Cargo": true,
"Reguler": true,
"Crossborder": true
},
"is_default": true,
"is_active": true,
"username": "rahasia",
"password": "rahasia",
"api_key": "rahasia",
"api_secret": "rahasia",
"account_id": null,
"account_name": null,
"created_by": "system",
"updated_by": "system",
"created_at": "2025-08-25T03:26:58.000000Z",
"updated_at": "2025-08-25T03:26:58.000000Z",
"logistic_provider_name": "DETHIX"
}
],
"pagination": {
"current_page": 1,
"per_page": 10,
"total": 7,
"last_page": 1,
"from": 1,
"to": 7,
"has_more_pages": false
}
},
"errors": null,
"request_id": "68ecd983-460f-484d-a2e6-b85169b9980d"
}