Get Started
we are going to help you to start and configure petroapp intigration by creating a copy of our documentntation and reports. Make sure you've read our directory structure articles before continuing.
https://app-public.staging.petroapp.app/webservice/
Credentials :
Please contact our support team to get your credentials.
simply this is our main modules you need to make an awesome integration
Generate Api Key
you have to use your main company user data [username , password] to get your api key to start with our web service configuration
As you might see in the get_apiKey directory;
- URL : https://app-public.staging.petroapp.app/webservice/get_apiKey
- Header Request parameters: none
- Method : POST
- Paramaters/body :
username*: your_company_username
password*: your_company_password - description : to return your api key .
- Notes:
expires_in return in seconds - success return:
{ "success": true, "message": "بترو اب يرحب بك", "data": { "api_key": "123123123123", "token_type": "bearer", "expires_in": 31536000 } } - failure return:
{ "success": false, "message": "بيانات المستخدم غير صحيحة", "data": "" }
Refresh Token
As you might see in the refresh_token directory;
- URL : https://app-public.staging.petroapp.app/webservice/refresh_token
- Header Request parameters:
Authorization :
Bearer your_api_token - Method : POST
- Paramaters/body : None
- description : to refresh your token.
- success return:
{ "success": true, "message": "بترو اب يرحب بك", "data": { "api_key": "123123123123", "token_type": "bearer", "expires_in": 31536000 } } - failure return:
{ "success": false, "message": "بيانات المستخدم غير صحيحة", "data": "" }
GET vehicles
List all vehicles (paginated).
- URL : https://app-public.staging.petroapp.app/webservice/vehicles?page=
page_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
plate : ( String, optional )
Vehicle plate or structure number to filter
- success return:
{ "success": true, "data": { "current_page": 1, "data": [ { "vehicle_id": 123, "company_branch_id": 10, "branch_name": "Branch name", "arabic_plate_letter": "س س س", "english_plate_letter": "S S S", "english_plate_number": "9 0 9 6", "arabic_plate_number": "٩ ٠ ٩ ٦", "trip_number": "trip-123", "consumption_method": "Has A Trip", "consumption_type": "limited", "max_consumption_by_rial": 500, "max_consumption_by_liters": 0, "current_consumption_by_rial": 100, "current_consumption_by_liters": null, "photo": null, "vehicle_available_days": "Sun,Mon,Tue,Wed,Thu,Fri,Sat", "brand": "Toyota", "model": "Camry", "type": "سيارة خفيفة", "year": 2020, "active": 1, "other_one": null, "other_two": null, "other_three": null, "odometer": "120000", "chassis_number": "A1234567", "internal_number": null, "consumption_settings": { "consumption_type": 2, "consumption_method": 2, "vehicle_consumption_by": "rial", "max_consumption": 500, "max_consumption_liters": 215.517, "current_consumption": 100, "current_consumption_liters": 43.103, "limited_fuel_time": null, "enable_fuel_accumulative_balance": false, "fuel_consumption_source": null, "company_trip_id": null, "trip": null, "operating_days": ["Sun", "Mon", "Tue", "Wed", "Thu"], "shifts": [] }, "services_settings": { "services_balance_method": "monthly", "services_balance": 70, "max_services_balance": 100, "services_consumption_type": null }, "washing_settings": { "washing_method": "weekly", "washing_type": 3, "washing_time": 1, "washing": [] } } ], "from": 1, "last_page": 5, "next_page_url": "https://app-public.staging.petroapp.app/webservice/vehicles?page=2", "path": "https://app-public.staging.petroapp.app/webservice/vehicles", "per_page": 10, "prev_page_url": null, "to": 10, "total": 52 } } - Settings objects :
consumption_settings,services_settingsandwashing_settingsreturn the vehicle's settings with the same names and values accepted by POST / PUT vehicles (numericconsumption_type/consumption_methodids). For a vehicle on a trip (method 4),tripholds the trip balance:{ "trip_number", "max_consumption", "max_consumption_liters", "current_consumption", "current_consumption_liters" }(the vehicle-level max and current are 0). The older flat keys (consumption_method,consumption_type,max_consumption_by_*, ...) are unchanged. - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
POST vehicles
Create a new vehicle.
- URL : https://app-public.staging.petroapp.app/webservice/vehicles
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
plate_letters : ( array )
e.g. ["X", "Y", "Z"]
plate_numbers : ( array )e.g. ["2", "0", "2", "0"]
fueltype_id : ( integer )required, exists in fuel_types
cartype_id : ( integer )required, exists in car_types
carbrand_id : ( integer )required, exists in car_brands
carmodel_id : ( integer )required, exists in car_models
consumption_rate : ( numeric )required, 1-100
company_branch_id : ( integer )required, exists in company_branches
tank_capacity : ( numeric )required
vehicle_consumption_by : ( string )"rial" or "liter". Required when your company uses both units; otherwise your company's unit is used
max_limit : ( numeric )per-transaction limit in SAR. Required when vehicle_consumption_by is "rial" (or your company uses amount only)
max_limit_liter : ( numeric )per-transaction limit in liters. Required when vehicle_consumption_by is "liter" (or your company uses liters only)
year_industry : ( numeric )required, e.g. 2020
chassis_no : ( string, optional )
internal_id : ( string, optional )
structure_no : ( string, optional )
installation_type : ( string )required, "Installation" or "Delivery"
consumption_type, consumption_method, max_consumption, operating_days, services_balance_method, washing_method / washing, ... : ( optional )see Consumption settings. Without them the vehicle is created with a daily limited consumption, as before. - Plate validation (plate_letters / plate_numbers) :
plate_letters: required array, 1–3 elements. Each letter must exist in the system (valid Arabic or English plate letters). Saudi Arabia: certain letter combinations are banned (e.g. S-E-X, A-S-S, B-A-R, B-A-D and their Arabic equivalents).
plate_numbers: required array, 1–4 elements. Each element must be a single digit (0–9). Arabic or Persian digits are accepted and normalized. The plate number cannot be all zeros.
Heavy / structure-only: For car type "heavy" or when configuration uses structure only,plate_lettersandplate_numbersare not used;structure_nois required (allowed: letters, Thai script, digits, hyphen, spaces).
Motor (Saudi): For car type "motor",plate_lettersallows at most 2 elements;carbrand_idandcarmodel_idare not required. - Example bodies (Create) :
1. Standard light vehicle (plate):
2. Heavy vehicle (structure_no only):{ "plate_letters": ["X", "Y", "Z"], "plate_numbers": ["2", "0", "2", "0"], "fueltype_id": 1, "cartype_id": 1, "carbrand_id": 1, "carmodel_id": 5, "consumption_rate": 50, "company_branch_id": 10, "tank_capacity": 60, "max_limit": 500, "year_industry": 2023, "chassis_no": "A1234567", "installation_type": "Installation" }
3. Motor (max 2 letters, no brand/model):{ "structure_no": "TRK-1001", "fueltype_id": 2, "cartype_id": 2, "consumption_rate": 80, "company_branch_id": 10, "tank_capacity": 200, "max_limit": 2000, "year_industry": 2022, "installation_type": "Delivery" }
4. Weekly limited consumption, working days and services balance:{ "plate_letters": ["A", "B"], "plate_numbers": ["1", "2", "3", "4"], "fueltype_id": 1, "cartype_id": 3, "consumption_rate": 20, "company_branch_id": 10, "tank_capacity": 10, "max_limit": 100, "year_industry": 2024, "installation_type": "Installation" }{ "plate_letters": ["X", "Y", "Z"], "plate_numbers": ["2", "0", "2", "1"], "fueltype_id": 1, "cartype_id": 1, "carbrand_id": 1, "carmodel_id": 5, "consumption_rate": 50, "company_branch_id": 10, "tank_capacity": 60, "max_limit": 500, "year_industry": 2023, "installation_type": "Installation", "consumption_type": 2, "consumption_method": 2, "max_consumption": 700, "operating_days": ["Sun", "Mon", "Tue", "Wed", "Thu"], "services_balance_method": "monthly", "services_balance": 100, "max_services_balance": 100 } - success return:
{ "status": true, "message": "added_successfully", "need_nfc": false, "id": 123 } - failure return:
{ "status": false, "message": "This_plate_number_is_already_exist" }
PUT vehicles
Update an existing vehicle.
- URL : https://app-public.staging.petroapp.app/webservice/vehicles
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: PUT
- Paramaters/body :
id : ( integer )
required, vehicle ID
plate_letters : ( array, optional )e.g. ["X", "Y", "Z"]
plate_numbers : ( array, optional )
fueltype_id : ( integer, optional )
cartype_id : ( integer, optional )
carbrand_id : ( integer, optional )
carmodel_id : ( integer, optional )
consumption_rate : ( numeric, optional )
company_branch_id : ( integer, optional )
tank_capacity, year_industry : ( optional )
vehicle_consumption_by : ( string )"rial" or "liter". Required when your company uses both units
max_limit / max_limit_liter : ( numeric )per-transaction limit. Whenever vehicle_consumption_by is sent, max_limit is required for "rial" and max_limit_liter for "liter" — send the vehicle's current value if you are not changing it
chassis_no, internal_id, structure_no : ( string, optional )
active : ( boolean, optional )
consumption_type, consumption_method, max_consumption, current_consumption, operating_days, services_balance_method, washing_method / washing, ... : ( optional )see Consumption settings. Without them the vehicle's consumption settings are not changed. - Plate validation (plate_letters / plate_numbers) :
If you send
plate_lettersorplate_numbers, both are required together. Same rules as POST: plate_letters 1–3 elements (valid letters only; Saudi: no banned combinations), plate_numbers 1–4 elements, each a single digit (0–9), not all zeros. Heavy/structure-only and motor rules apply as in create. - Example bodies (Update) :
1. Update only active status:
2. Update plate (letters and numbers together):{ "id": 123, "active": false }
3. Update heavy vehicle structure_no and consumption:{ "id": 123, "plate_letters": ["A", "B", "C"], "plate_numbers": ["9", "8", "7", "6"] }
4. Partial update (branch and limit):{ "id": 456, "structure_no": "TRK-1002", "max_limit": 2500, "consumption_rate": 75 }
5. Switch to a monthly limit and set the current balance:{ "id": 123, "company_branch_id": 12, "max_limit": 600 }
6. Move the vehicle to a trip:{ "id": 123, "consumption_type": 2, "consumption_method": 3, "max_consumption": 900, "current_consumption": 600 }
7. Open (unlimited) consumption:{ "id": 123, "consumption_type": 2, "consumption_method": 4, "trip_number": "TRIP-2026-001", "trip_start": "2026-11-01", "trip_end": "2026-11-10", "trip_consumption": 300 }{ "id": 123, "consumption_type": 1 } - success return:
{ "status": true, "message": "updated_successfully", "id": 123 } - failure return:
{ "status": false, "message": "vehicle_not_found" }
DELETE vehicles/{id}
Delete a vehicle by ID.
- URL : https://app-public.staging.petroapp.app/webservice/vehicles/
id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: DELETE
- Paramaters/body : None.
idin URL path. - success return:
{ "status": true, "message": "deleted_successfully" } - failure return:
{ "status": false, "message": "Vehicle Not Found" }
GET delegates
List all delegates (paginated).
- URL : https://app-public.staging.petroapp.app/webservice/delegates?page=
page_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
name : ( String, optional )
Filter by delegate name (partial match)
username : ( String, optional )Filter by username (partial match)
code : ( String, optional )Filter by delegate code
active : ( 0|1, optional )Filter by active status
limit : ( integer, optional )Items per page (default 10)
get_deleted : ( boolean, optional )Include soft-deleted delegates when true
- success return:
{ "success": true, "data": { "data": [ { "id": 1, "name": "Delegate Name", "code": "DLG-001", "username": "delegate_user", "mobile": "0501234567", "email": "delegate@example.com", "active": true, "status": "active", "allow_to_use_any_vehicle": 0, "company_branch_id": 10, "vehicle_ids": [1, 2], "created_at": "2024-01-15T10:00:00+00:00", "updated_at": "2024-01-15T10:00:00+00:00" } ], "current_page": 1, "per_page": 10, "total": 25 } } - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
POST delegates
Create a new delegate.
- URL : https://app-public.staging.petroapp.app/webservice/delegates
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
name : ( string )
required
username : ( string )required, min 6 chars, unique per company
password : ( string )required, must satisfy password policy
email : ( string, optional )valid email, unique if provided
mobile : ( string, optional )numeric
active : ( boolean )required, default true
company_branch_id : ( integer )required, exists in company_branches
allow_to_use_any_vehicle : ( integer )required, default 0vehicle_ids : ( array of integers, optional )0= disabled (must specifyvehicle_ids)
1= allowed to use any vehicle in the same delegate branch
2= allowed to use any vehicle in the companyrequired if allow_to_use_any_vehicle is 0; vehicle IDs belonging to company
- Example request body (Create) :
1. allow_to_use_any_vehicle = 0 (restricted to specific vehicles) :
2. allow_to_use_any_vehicle = 1 (any vehicle in the same branch, no vehicle_ids required) :{ "name": "Ahmed Ali", "username": "ahmed_delegate", "password": "SecurePass123!", "email": "ahmed@example.com", "mobile": "0501234567", "active": true, "company_branch_id": 10, "allow_to_use_any_vehicle": 0, "vehicle_ids": [1, 2] }
3. allow_to_use_any_vehicle = 2 (any vehicle in the company, no vehicle_ids required) :{ "name": "Sara Mohamed", "username": "sara_delegate", "password": "SecurePass123!", "email": "sara@example.com", "active": true, "company_branch_id": 10, "allow_to_use_any_vehicle": 1 }{ "name": "Mona Khaled", "username": "mona_delegate", "password": "SecurePass123!", "email": "mona@example.com", "active": true, "company_branch_id": 10, "allow_to_use_any_vehicle": 2 } - success return:
{ "success": true, "data": { "message": "added_successfully" } } - failure return:
{ "success": false, "message": "", "errors": { "username": ["The username has already been taken."] } }
PUT delegates/{id}
Update an existing delegate.
- URL : https://app-public.staging.petroapp.app/webservice/delegates/
id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: PUT
- Paramaters/body :
name : ( string, optional )
username : ( string, optional )min 6 chars, unique per company
password : ( string, optional )must satisfy password policy if provided
email : ( string, optional )
mobile : ( string, optional )numeric
active : ( boolean, optional )
company_branch_id : ( integer, optional )exists in company_branches
allow_to_use_any_vehicle : ( integer, optional )vehicle_ids : ( array of integers, optional )0= disabled (must specifyvehicle_ids)
1= allowed to use any vehicle in the same delegate branch
2= allowed to use any vehicle in the company
- Example request body (Update) :
1. Update name and mobile only:
2. Update active status and branch:{ "name": "Ahmed Ali Updated", "mobile": "0509876543" }
3. Update password and allow any vehicle in the company:{ "active": false, "company_branch_id": 12 }{ "password": "NewSecurePass456!", "allow_to_use_any_vehicle": 2 } - success return:
{ "success": true, "data": { "message": "updated_successfully" } } - failure return:
{ "success": false, "message": "not_found" }
GET delegates/{id}
Retrieve a single delegate by ID.
- URL : https://app-public.staging.petroapp.app/webservice/delegates/
id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body : None.
idin URL path. - success return:
{ "success": true, "data": { "id": 1, "name": "Delegate Name", "code": "DLG-001", "username": "delegate_user", "mobile": "0501234567", "email": "delegate@example.com", "active": true, "status": "active", "allow_to_use_any_vehicle": 0, "company_branch_id": 10, "vehicle_ids": [1, 2], "created_at": "2024-01-15T10:00:00+00:00", "updated_at": "2024-01-15T10:00:00+00:00" } } - failure return:
{ "success": false, "message": "not_found" }
POST delegates/{id}/activate
Activate a delegate by ID.
- URL : https://app-public.staging.petroapp.app/webservice/delegates/
id/activate - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body : Optional.
idin URL path. Empty object or no body. - Example request body :
{} - success return:
{ "success": true, "message": "delegate_activated_successfully" } - failure return:
{ "success": false, "message": "not_found" }
POST delegates/{id}/deactivate
Deactivate a delegate by ID.
- URL : https://app-public.staging.petroapp.app/webservice/delegates/
id/deactivate - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body : Optional.
idin URL path. Empty object or no body. - Example request body :
{} - success return:
{ "success": true, "message": "delegate_deactivated_successfully" } - failure return:
{ "success": false, "message": "not_found" }
POST delegates/{id}/restore
Restore a soft-deleted delegate by ID.
- URL : https://app-public.staging.petroapp.app/webservice/delegates/
id/restore - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body : Optional.
idin URL path. Empty object or no body. - Example request body :
{} - success return:
{ "success": true, "data": { "message": "restored_successfully" } } - failure return:
{ "success": false, "message": "not_found" }
GET branches
List your company branches (paginated), optionally filtered by name.
- URL : https://app-public.staging.petroapp.app/webservice/branches?page=
page_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
search : ( String, optional )
Filter by branch name, Arabic or English (partial match)
- success return:
{ "success": true, "data": { "current_page": 1, "data": [ { "id": 10, "arabic_title": "فرع الرياض", "english_title": "Riyadh Branch" } ], "from": 1, "last_page": 1, "next_page_url": null, "path": "https://app-public.staging.petroapp.app/webservice/branches", "per_page": 10, "prev_page_url": null, "to": 1, "total": 1 } } - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
GET car_types
List car types (reference data).
- URL : https://app-public.staging.petroapp.app/webservice/car_types
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "success": true, "data": [ { "id": 1, "title": "سيارة خفيفة" }, { "id": 2, "title": "معدات ثقيلة" } ] } - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
GET car_brands
List car brands (reference data).
- URL : https://app-public.staging.petroapp.app/webservice/car_brands
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "status": true, "data": [ { "id": 1, "title": "Toyota" }, { "id": 2, "title": "Ford" } ] } - failure return:
{ "status": false, "message": "Unauthenticated.", "data": null }
GET car_models/{car_brand_id}
List car models for a given brand.
- URL : https://app-public.staging.petroapp.app/webservice/car_models/
car_brand_id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
car_brand_idin URL path. - success return:
{ "carModels": [ { "id": 1, "title": "Camry" }, { "id": 2, "title": "Corolla" } ] } - failure return:
{ "success": false, "message": "Unauthenticated.", "data": null }
GET fuel_types
List fuel types (reference data).
- URL : https://app-public.staging.petroapp.app/webservice/fuel_types
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "status": true, "data": [ { "id": 1, "type": "91", "name": "91" }, { "id": 2, "type": "95", "name": "95" }, { "id": 3, "type": "diesel", "name": "ديزل" } ] } - failure return:
{ "status": false, "message": "Unauthenticated.", "data": null }
Consumption settings (POST / PUT vehicles)
Optional parameters of POST vehicles and PUT vehicles that manage the vehicle's fuel, services and washing consumption, following the same rules as the company dashboard.
Each group is used only when its first parameter is sent. Requests without them keep the existing behaviour: POST creates a daily limited vehicle from max_limit and PUT leaves the consumption settings unchanged.
Validation messages follow the lang request header: lang: en (default) or lang: ar.
- Fuel (sent when
consumption_typeis present) :consumption_type : ( integer )1 = open (unlimited), 2 = limited. See GET consumption_types. Open removes the vehicle's trip and shifts and sets its max and current balances to 0
consumption_method : ( integer, required when consumption_type = 2 )1 daily, 2 weekly, 3 monthly, 4 by trip, 5 by shifts, 6 unlimited duration. See GET consumption_methods
limited_fuel_time : ( integer, optional )min 0
enable_fuel_accumulative_balance : ( boolean, optional )applied only when the feature is enabled for your country
fuel_consumption_source : ( string, optional )"external" or "both", applied only when enabled for your company - Balances and units :
Send each balance in the vehicle's unit (
vehicle_consumption_by:rialorliter, or your company's only unit). The amount field (e.g.max_consumption) is required forrialand the liters field (e.g.max_consumption_liters) forliter; the other side is calculated from the fuel type price. You can also send both: then the two must match at the fuel price (each side rounded to 3 decimals), otherwise the request fails with 422. This applies to every pair: max, current, each shift and the trip.
Whenfueltype_idchanges and a balance is not sent, the side outside the vehicle's unit is recalculated at the new fuel price. - Daily / weekly / monthly / unlimited duration (methods 1, 2, 3, 6) :
max_consumption / max_consumption_liters : ( numeric, min 0 )
period limit
current_consumption / current_consumption_liters : ( numeric, optional, PUT only )current balance. If both are sent they must match at the fuel price. If omitted, the vehicle keeps its current balance; a vehicle that was open, on a trip or on shifts starts at the max. On POST the current balance always starts at the max. The current balance changes only when you send it: if you lower the max below the current balance and do not send current, the vehicle keeps its balance until the next period reset — send current_consumption to apply the new limit immediately. - By trip (method 4) :
trip_number : ( string )
new trip number, must be unique. Required unless choosen_trip is sent
choosen_trip : ( integer, optional )id of an existing trip of your company, instead of trip_number
trip_start, trip_end : ( date )required, trip_end on or after trip_start
trip_consumption / trip_max_consumption_liter : ( numeric, min 0 )trip limit
trip_current_consumption / trip_current_consumption_liter : ( numeric, optional, PUT only )with choosen_trip and omitted, the trip keeps its balance
trip_status : ( integer, optional )1 active (default), 0 inactive - By shifts (method 5) :
shifts : ( array, required, min 1 )
replaces the vehicle's shifts
shifts.*.company_shift_id : ( integer )a shift of your company, see GET company_shifts; no duplicates
shifts.*.max_consumption / shifts.*.max_consumption_liters : ( numeric, min 0 )
shifts.*.current_consumption / shifts.*.current_consumption_liters : ( numeric, optional, PUT only )defaults to the shift max - Working days (sent when
operating_daysis present) :operating_days : ( array, min 1 )any of "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", each day once (duplicates are rejected with 422). Default on POST: every day - Services balance (sent when
services_balance_methodis present, services enabled for your company) :services_balance_method : ( string )open, daily, weekly or monthly
services_balance, max_services_balance : ( numeric, min 0 )required for daily, weekly and monthly
services_consumption_type : ( string, optional ) - Washing (sent when
washing_methodorwashingis present; ignored on POST and PUT when your company's Washing service is off) :Single washing type: washing_method ( string )open, daily, weekly or monthly, washing_type ( integer )see GET washing_types/{car_model_id}, washing_time ( integer )number of washes, required unless open
Multiple washing types (when enabled for your country): washing ( array ) of{ "washing_type", "washing_method" (open, daily, weekly, monthly, annually), "washing_time" }. The list replaces the vehicle's washing settings; an empty list[]removes them all. - Example (PUT, shifts) :
{ "id": 123, "consumption_type": 2, "consumption_method": 5, "shifts": [ { "company_shift_id": 4, "max_consumption": 80 }, { "company_shift_id": 5, "max_consumption": 60, "current_consumption": 20 } ] } - validation failure return (422):
{ "status": false, "message": "The consumption method field is required.", "errors": { "consumption_method": ["The consumption method field is required."] } }
GET consumption_types
List consumption types (reference data for consumption_type).
- URL : https://app-public.staging.petroapp.app/webservice/consumption_types
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "status": true, "data": [ { "id": 1, "title": "Opened" }, { "id": 2, "title": "Limited" } ] }
GET consumption_methods
List consumption methods (reference data for consumption_method).
- URL : https://app-public.staging.petroapp.app/webservice/consumption_methods
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "status": true, "data": [ { "id": 1, "title": "Daily" }, { "id": 2, "title": "Weekly" }, { "id": 3, "title": "Monthly" }, { "id": 4, "title": "By trip" }, { "id": 5, "title": "By shifts" }, { "id": 6, "title": "Unlimited duration" } ] }
GET washing_types/{car_model_id}
List the washing types available for a car model (reference data for washing_type).
- URL : https://app-public.staging.petroapp.app/webservice/washing_types/
car_model_id - Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "status": true, "data": [ { "id": 3, "title": "External wash" }, { "id": 4, "title": "Full wash" } ] } - failure return (car_model_id not a positive integer or unknown) — HTTP 404:
{ "status": false, "message": "Car model not found" }
GET company_shifts
List your company's shifts (reference data for shifts.*.company_shift_id).
- URL : https://app-public.staging.petroapp.app/webservice/company_shifts
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return:
{ "status": true, "data": [ { "id": 4, "name": "Morning", "started_at": "08:00:00", "ended_at": "16:00:00" }, { "id": 5, "name": "Evening", "started_at": "16:00:00", "ended_at": "23:59:00" } ] }
Vehicles
Here you will get all your vehicles
As you might see in the vehicles directory;
- URL : https://app-public.staging.petroapp.app/webservice/vehicles?page=
page_number - Paramaters/body :
plate : ( String )
Example [ X Y Z 2 0 2 0 ] Vehicle Plate Number Or Truck Structure Number
- Header Request parameters:
Authorization :
Bearer your_api_token - Method :GET
- success return:
{ "success": true, "data": { "current_page": 1, "data": [ { "vehicle_id": 123, "branch_name": "Branch test1", "arabic_plate_letter": "س س س", "english_plate_letter": "S S S", "english_plate_number": "9 0 9 6", "arabic_plate_number": "٩ ٠ ٩ ٦", "trip_number": "test-123", "consumption_method": "NULL", "consumption_type": "NULL", "max_consumption_by_rial": 0, "max_consumption_by_liters": 0, "current_consumption_by_rial": 0, "current_consumption_by_liters": null, "photo": null, "vehicle_available_days": "Sun,Mon,Tue,Wed,Thu,Fri,Sat", "brand": " Austin", "model": " Mini Cooper", "type": "معدات ثقيلة", "year": null, "other_one": null, "other_two": null, "other_three": null, "chassis_number": "A1234567", "odometer":"120000", "internal_number": null } ], "from": 1, "last_page": 52, "next_page_url": "https://app-public.staging.petroapp.app/webservice/vehicles?page=2", "path": "https://app-public.staging.petroapp.app/webservice/vehicles", "per_page": 1, "prev_page_url": null, "to": 1, "total": 52 } } - failure return:
{ "message": "no data found", "success": true, "data": { "current_page": 1, "data": [], "from": null, "last_page": 0, "next_page_url": null, "path": "https://app-public.staging.petroapp.app/webservice/vehicles", "per_page": 10, "prev_page_url": null, "to": null, "total": 0 } }
insert Trip
Here you will add new trip to vehicle
As you might see in the insert_trip directory;
- URL : https://app-public.staging.petroapp.app/webservice/insert_trip
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
plate : ( String )
Example [ X Y Z 2 0 2 0 ] Vehicle Plate Number Or Truck Structure Number
trip_number: ( String )your new trip number
max_trip_consumption_rial : ( double )max trip consumption in saudi rial (SRA)
start_date : ( Date ) format exampl YYYY-mm-dd
end_date : ( Date ) format example YYYY-mm-dd
- success return::
{ "success": true,"message":"trip has been inserted", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }
Increase vehicle consumption
Here you can update vehicle consumption
Note that ! vehicle will be not related with any trips and this endpoint used to only increase vehicle consumption value
As you might see in the increase_vehicle_consumption directory;
- URL : https://app-public.staging.petroapp.app/webservice/increase_vehicle_consumption
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
plate : ( String )
Example [ X Y Z 2 0 2 0 ] Vehicle Plate Number Or Truck Structure Number
current_consumption : ( double )vehicle consumption in saudi rial (SRA)
vehicle_consumption_by : ( string )"rial" or "liter"; required when your company uses both units
current_consumption_liters : ( double )amount in liters, instead of current_consumption, for liter vehicles
is_decrement : ( integer, optional )1 to subtract the amount instead of adding it
keep_consumption_method : ( boolean, optional )false / 0 (default) or true / 1. With true only the current balance changes and the vehicle keeps its consumption method and limit (daily, weekly, monthly, unlimited duration). Not allowed for vehicles on a trip, on shifts or with open consumption. Without it the vehicle is switched to unlimited duration, as before. - success return::
{ "success": true,"message":"vehicle consumption has been increased", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} } - failure return (keep_consumption_method on a trip, shift or open vehicle):
{ "success": false, "message": "This vehicle's balance is kept on its trip or shifts, or its consumption is open, so it cannot be changed while keeping the consumption method", "data": "" }
Update Trip
Here you will add new trip to vehicle
As you might see in the update_trip directory;
To update current trip skip {trip_number}
if you want update a one of trip parameter just need to skip others parameters
- URL : https://app-public.staging.petroapp.app/webservice/update_trip
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
current_trip_number : ( String )
your old trip number
trip_number: ( String )your new trip number
increase_trip_consumption : ( double )To Increase current trip consumption and existed max trip consumption
reset : ( Boolean )To reset trip current consumption to equal existed max trip consumptionif reset parameter is true increase_trip_consumption will equal NULLtrip_consumption : ( double )To set trip consumption value and current consumption you needn't to send reset or increase_trip_consumption
start_date : ( Date ) format exampl YYYY-mm-dd
end_date : ( Date ) format example YYYY-mm-dd
- success return::
{ "success": true,"message":"trip has been updated", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }
Updated trips list
Here you will get updated trips had consumed with vehicle plate number
page limit with 10 records to get second records send parameter page=2... pagination structure
As you might see in the updated_trips directory;
- URL : https://app-public.staging.petroapp.app/webservice/updated_trips
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- Paramaters/body :
date_from : ( Date ) format exampl YYYY-mm-dd H:i:s
date_to : ( Date ) format example YYYY-mm-dd H:i:s
status : ( Boolean ) true : active / false : inactive - success return::
{ "success": true, "data": [ { "trip_number": "81002", "trip_start": "2022-05-31 02:00:00", "trip_end": "2022-06-01 02:00:00", "trip_consumption": 500, "consumed": 100, "remaining_balance": 400, "active": "active", "updated_at": "2022-05-31T07:49:25.000000Z", "vehicle": "H H H - 9 9 9 9" } ] } - failure return:
{ "success": false,"data": {} }
Assign vehicle to trip
Here you will assign trip to vehicle
As you might see in the assign_vehicle_to_trip directory;
- URL : https://app-public.staging.petroapp.app/webservice/assign_vehicle_to_trip
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
trip_number : ( STRING )
your trip number
plate: ( STRING )Vehicle plate - success return::
{ "success": true,"message":"vehicle now can using this trip", "data": {} } - failure return:
{ "success": false,"message":"this vehicle is not exist", "data": {} }
Remove vehicle from trip
Here you will remove vehicle from trip
As you might see in the remove_vehicle_from_trip directory;
- URL : https://app-public.staging.petroapp.app/webservice/remove_vehicle_from_trip
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
trip_number : ( STRING )
your trip number
plate: ( STRING )Vehicle plateNote : vehicle consumption method will changed to open then (max_consumption , current_consumption )
values will be ( 0 SAR ) - success return::
{ "success": true,"message":"vehicle now can not using this trip", "data": {} } - failure return:
{ "success": false,"message":"this vehicle is not exist", "data": {} }
Active Trip
To active trip use this endpoint
As you might see in the active_trip directory;
- URL : https://app-public.staging.petroapp.app/webservice/active_trip/
trip_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- success return::
{ "success": true,"message":"trip has been active", "data": {} } - failure return:
{ "success": false,"message":"trip not found", "data": {} }
Deactivate Trip
To stop trip use this endpoint
As you might see in the deactivate_trip directory;
- URL : https://app-public.staging.petroapp.app/webservice/deactivate_trip/
trip_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- success return::
{ "success": true,"message":"trip has been deactivate", "data": {} } - failure return:
{ "success": false,"message":"trip not found", "data": {} }
Trip status log
trip log to check who`s activate or deactivate trip
As you might see in the trip_status_logs directory;
- URL : https://app-public.staging.petroapp.app/webservice/trip_status_logs
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: GET
- success return::
{ "success": true, "data": { "current_page": 1, "data": [ { "trip_consumption": 1, "current_consumption": 1, "trip_number": "75002", "username": "app", "status": 0 }, { "trip_consumption": 1, "current_consumption": 1, "trip_number": "75002", "username": "app", "status": 1 } ], "first_page_url": "http://127.0.0.1:9999/webservice/trip_status_logs?page=1", "from": 1, "last_page": 1, "last_page_url": "http://127.0.0.1:9999/webservice/trip_status_logs?page=1", "links": [ { "url": null, "label": "pagination.previous", "active": false }, { "url": "http://127.0.0.1:9999/webservice/trip_status_logs?page=1", "label": "1", "active": true }, { "url": null, "label": "pagination.next", "active": false } ], "next_page_url": null, "path": "http://127.0.0.1:9999/webservice/trip_status_logs", "per_page": 10, "prev_page_url": null, "to": 2, "total": 2 } } - failure return:
{ "success": false,"message":"trip not found", "data": {} }
Vehicles Trip Log
Here you will get all your vehicles trip log
As you might see in the vehicles_trip_log_data directory;
- URL : https://app-public.staging.petroapp.app/webservice/vehicles_trip_log_data?page=
page_number - Paramaters/body :
trip_number: ( String )
trip number - Header Request parameters:
Authorization :
Bearer your_api_token - Method:GET
- success return:
{ "success": true, "data": { "current_page": 1, "data": [ { "branch_name": "Branch test1", "plate_letter_arabic": "ر ر ر", "plate_letter_english": "R R R", "structure_number": null, "plate_arabic_number": "۰ ۰ ۰ ۰", "english_plate_number": "0 0 0 0", "trip_number": "5dc4ce0d8f92d", "trip_consumption_by_rial": 100, "current_consumption_by_rial": 80, "trip_start_date": "2019-09-08 00:00:00", "trip_end_date": "2019-11-09 00:00:00", "inserted_at": null, "fuel_type": "91" } ], "from": 1, "last_page": 1, "next_page_url": "http://localhost/petroappwebprod/webservice/vehicles_trip_log_date?page=2", "path": "http://localhost/petroappwebprod/webservice/vehicles_trip_log_date", "per_page": 10, "prev_page_url": null, "to": 1, "total": 1 } } - failure return:
{ "message": "no data found", "success": true, "data": { "current_page": 1, "data": [], "from": null, "last_page": 0, "next_page_url": null, "path": "https://app-public.staging.petroapp.app/webservice/vehicles_trip_log_date", "per_page": 10, "prev_page_url": null, "to": null, "total": 0 } }
Get Bills
Here you can get your company bills with filter inputs
As you might see in the bills directory;
- Language parameters : ar || en
- URL : https://app-public.staging.petroapp.app/webservice/bills?page=
page_number&from=YYYY-mm-dd&to=YYYY-mm-dd&branch_name=your_branch_name&lang=en - Header Request parameters:
Authorization :
Bearer your_api_token - Method : GET
- parameters:
from : :( Date ) format example YYYY-mm-dd
to :( Date ) format example YYYY-mm-dd
branch_name : ( String ) Example: branch test - Each entry also carries the bill's attachments:
fuel_pump_image,extra_fuel_pump_image,odometer_image— full URLs, ornullwhen that photo wasn't captured. - Successfuly Response:
{ "success": true, "data": { "current_page": 1, "data": [ { "bill_date": "2019-10-09 12:55:33", "trip_number": null, "payment_method": 1, "billDate": "2019-10-09 12:55:33", "status": 0, "branch_name": "Branch test1", "station_name": "حساب تجريبي", "station_lat": 21.63234578000000141173586598597466945648193359375, "station_lng": 48.62287828000000189376805792562663555145263671875, "delegate_name": null, "plate_letter": null, "plate_snum": null, "cost": 50.5, "num_of_liters": 107.4470000000000027284841053187847137451171875, "internal_number": null, "structure_number": null, "city": " طريف", "district": " الورود", "payment_method_text": "نقدى", "odometer":"120000", "fuel_pump_image": "https://app-public.staging.petroapp.app/uploads/bills/pump.jpg", "extra_fuel_pump_image": null, "odometer_image": null } ], "from": 1, "last_page": 1, "next_page_url": https://pre.petroapp.com.sa/webservice/bills?page=2, "path": "https://pre.petroapp.com.sa/webservice/bills", "per_page": 10, "prev_page_url": null, "to": 3, "total": 3 } }
Get Bills For Trips
Here you will your company bills with trip number input
As you might see in the bills directory;
- URL : https://pre.petroapp.com.sa/webservice/bills?page=
page_number&trip_number=trip_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method :GET
- parameters:
trip_number: (String)
- Successfuly Response:
{ "success": true, "data": { "current_page": 1, "data": [ { "bill_date": "2019-10-09 12:55:33", "trip_number": 123123, "payment_method": 1, "billDate": "2019-10-09 12:55:33", "status": 0, "branch_name": "Branch test1", "station_name": "حساب تجريبي", "station_lat": 21.63234578000000141173586598597466945648193359375, "station_lng": 48.62287828000000189376805792562663555145263671875, "delegate_name": null, "plate_letter": null, "plate_snum": null, "cost": 50.5, "num_of_liters": 107.4470000000000027284841053187847137451171875, "internal_number": null, "structure_number": null, "city": " طريف", "district": " الورود", "payment_method_text": "نقدى", "odometer":"120000", "fuel_pump_image": "https://app-public.staging.petroapp.app/uploads/bills/pump.jpg", "extra_fuel_pump_image": null, "odometer_image": null } ], "from": 1, "last_page": 1, "next_page_url": "https://pre.petroapp.com.sa/webservice/bills?page2", "path": "https://pre.petroapp.com.sa/webservice/bills", "per_page": 10, "prev_page_url": null, "to": 3, "total": 3 } }
Get Service Bills
Here you can get your company service bills (oil & filter, battery, tire) with filter inputs
As you might see in the service_bills directory;
- URL : https://app-public.staging.petroapp.app/webservice/service_bills?date_from=
YYYY/mm/dd HH:mm:ss&date_to=YYYY/mm/dd HH:mm:ss&type=oil_and_filter - Header Request parameters:
Authorization :
Bearer your_api_token - Method : GET
- parameters:
date_from* : ( Date ) format example YYYY/mm/dd HH:mm:ss
date_to* : ( Date ) format example YYYY/mm/dd HH:mm:ss
type* : ( String ) one of: oil_and_filter, battery, tire
vehicle_plate : ( String ) Example: A B C 1 2 3 4
branch_id : ( Integer )
bill_no : ( Integer )
limit : ( Integer ) default 10 - Each entry in
productsalso carriesservice_fees(fee amount per unit, 0 if none),service_fee_quantity(defaults to the productquantitywhen not set), andtotal_service_fees(service_fees×service_fee_quantity). Include these when reconciling the bill's total, sincetotal_costalone does not. - Successfuly Response:
{ "data": [ { "id": 6188, "company_branch_title": "Branch test1", "vehicle_id": 683752, "vehicle": "A A A-4 1 3 9", "letter_ar": "ا ا ا", "letter_en": "A A A", "num_en": "4 1 3 9", "num_ar": "٤١٣٩", "structure_no": "", "products": [ { "name": "battery", "price": "35.200", "quantity": 2, "total_cost": 70.4, "service_fees": 5, "service_fee_quantity": 1, "total_service_fees": 5 } ], "products_details": [ { "id": 10, "product_image": "https://app-public.staging.petroapp.app/uploads/services_bills/product.jpg", "warranty_image": "https://app-public.staging.petroapp.app/uploads/services_bills/warranty.jpg", "serial_number": "SN-001", "axle": "front", "position": "left", "double": "no" } ], "service_center_name": "PetroApp Service Center", "service_center_branch_name": "Riyadh Branch", "vat_percent": 0.15, "cost": 126.96, "cost_inc_vat": 126.96, "damaged_battery_price": 30, "created_at": "2025-01-02 01:15 PM" } ], "links": { "first": "https://app-public.staging.petroapp.app/webservice/service_bills?page=1", "last": "https://app-public.staging.petroapp.app/webservice/service_bills?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "links": [ { "url": null, "label": "« Previous", "page": null, "active": false }, { "url": "https://app-public.staging.petroapp.app/webservice/service_bills?page=1", "label": "1", "page": 1, "active": true }, { "url": null, "label": "Next »", "page": null, "active": false } ], "path": "https://app-public.staging.petroapp.app/webservice/service_bills", "per_page": 10, "to": 1, "total": 1 }, "status": true }
Get Washing Bills
Here you can get your company washing bills with filter inputs
As you might see in the washing_bills directory;
- URL : https://app-public.staging.petroapp.app/webservice/washing_bills?date_from=
YYYY/mm/dd HH:mm:ss&date_to=YYYY/mm/dd HH:mm:ss - Header Request parameters:
Authorization :
Bearer your_api_token - Method : GET
- parameters:
date_from* : ( Date ) format example YYYY/mm/dd HH:mm:ss
date_to* : ( Date ) format example YYYY/mm/dd HH:mm:ss
branch_id : ( Integer )
vehicle : ( Integer ) vehicle id
bill_no : ( Integer )
limit : ( Integer ) default 10 - Successfuly Response:
{ "data": [ { "id": 170, "vehicle_id": 1711, "vehicle": "B T J-6 2 4 3", "structure_no": "-", "internal_id": "-", "company_branch_title": "Branch test1", "washing_center": "PetroApp Washing Center", "washing_branch_title": "Riyadh Branch", "worker_name": "Ali Worker", "cost": "50.000", "cost_inc_vat": "50.000", "washing_types_title": "Normal full washing", "vehicle_model_type_title": "small", "created_at": "2025-01-09 02:40 PM", "letter_ar": "ح ط ب", "letter_en": "B T J", "num_en": "6 2 4 3", "num_ar": "٦ ٢ ٤ ٣", "images_before_washing": [ "https://app-public.staging.petroapp.app/uploads/washing_bills/before_1.jpg" ], "images_after_washing": [ "https://app-public.staging.petroapp.app/uploads/washing_bills/after_1.jpg" ] } ], "links": { "first": "https://app-public.staging.petroapp.app/webservice/washing_bills?page=1", "last": "https://app-public.staging.petroapp.app/webservice/washing_bills?page=1", "prev": null, "next": null }, "meta": { "current_page": 1, "from": 1, "last_page": 1, "links": [ { "url": null, "label": "« Previous", "page": null, "active": false }, { "url": "https://app-public.staging.petroapp.app/webservice/washing_bills?page=1", "label": "1", "page": 1, "active": true }, { "url": null, "label": "Next »", "page": null, "active": false } ], "path": "https://app-public.staging.petroapp.app/webservice/washing_bills", "per_page": 10, "to": 1, "total": 1 }, "status": true, "total_cost": "50.000", "total_cost_with_vat": "50.000" }
PetroApp Locations
Here you will get all petroapp locations
As you might see in the petroapp_locations directory;
- URL : https://pre.petroapp.com.sa/webservice/petroapp_locations?page=
page_number - Header Request parameters:
Authorization :
Bearer your_api_token - Method : GET
- Params: Response with station title , lat / lng , station services
- success return locations:
{ "request": null, "locs": [ { "station_name": "adwa elezz", "lat": 24.551790199999999231295078061521053314208984375, "lng": 46.6297075199999966343966661952435970306396484375, "id": 8, "service": [ { "service_name": "صيانة سيارات" }, { "service_name": "بنشر" }, { "service_name": "مغسلة سيارات" }, { "service_name": "سوبر ماركت" }, { "service_name": "صراف الي" }, { "service_name": "كوفي شوب" }, { "service_name": "مسجد" }, { "service_name": "غيار زيت" } ], "petrol_prices": [ { "id": 1, "fuel_type": "91" }, { "id": 3, "fuel_type": "ديزل" } ], "diesel": "yes" }, ] }
PetroApp Locations Filter
As you might see in the petroapp_locations directory;
- URL : https://pre.petroapp.com.sa/webservice/petroapp_locations?page=
page_number&search_request=lat,lng - OR : https://pre.petroapp.com.sa/webservice/petroapp_locations?page=
page_number&search_request=station_name - Header Request parameters:
Authorization :
Bearer your_api_token - Method:GET
- Paramaters:
search_request:
lat,lng||(String) station_name||(String) station_services - search_request with latitude longitude type lat,lng the same this way 24.55179019999,24.55179019999
- search_request with title type any String title and if exist you will get station data , return with request letter
{
"lat": "24.551790199999999231295078061521053314208984375",
"lng": "46.6297075199999966343966661952435970306396484375",
"request": "24.551790199999999231295078061521053314208984375,46.6297075199999966343966661952435970306396484375",
"locs": [
{
"station_name": "adwa elezz",
"lat": 24.551790199999999231295078061521053314208984375,
"lng": 46.6297075199999966343966661952435970306396484375,
"id": 8,
"service": [
{
"service_name": "صيانة سيارات"
},
{
"service_name": "بنشر"
},
{
"service_name": "مغسلة سيارات"
},
{
"service_name": "سوبر ماركت"
},
{
"service_name": "صراف الي"
},
{
"service_name": "كوفي شوب"
},
{
"service_name": "مسجد"
},
{
"service_name": "غيار زيت"
}
],
"petrol_prices": [
{
"id": 1,
"fuel_type": "91"
},
{
"id": 3,
"fuel_type": "ديزل"
}
],
"diesel": "yes"
},
]
}
Add delegate
Here you can add new delegate
As you might see in the add_delegate directory;
- URL : https://app-public.staging.petroapp.app/webservice/add_delegate
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
name : :( string ) example delegate name
username :( string ) example delegate username
password : ( String ) Example: Aa12345678
mobile : ( String ) Example: 102030405060
email : ( String ) Example: delegate@gmail.com
plate : ( String ) Example: Z Z Z 1 1 1 1
active : ( integer ) Example: 1 or 0
company_branch_id : ( integer ) Example: 120
- success return::
{ "success": true,"message":"The addition was successful", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }
Update delegate
Here you can update delegate code and status
As you might see in the update_delegate directory;
- URL : https://app-public.staging.petroapp.app/webservice/update_delegate
- Header Request parameters:
Authorization :
Bearer your_api_token - Method: POST
- Paramaters/body :
username :( string ) example delegate username
code : ( String ) Example: 1234
status : ( String ) Example: active or inactive - success return::
{ "success": true,"message":"The edit has been successfully made", "data": {} } - failure return:
{ "success": false,"message":"error is occured", "data": {} }