Endpoint
- TANQUEO: Regular fuel refill with vehicle and driver information
- ANTICIPO: Advance payment to fuel station without specific vehicle assignment
Authentication
Requires JWT authentication token. The authenticated user’s ID is automatically recorded ascreado_por.
Request Body
Common Fields (Required for Both Types)
Transaction date in format
YYYY-MM-DDFuel station identifier (must exist in
areas_bombas table)Operational area identifier (must exist in
areas_operacion table)Concept classification:
OPERATIVO- Operational use (default)ADMINISTRATIVO- Administrative use
Operation type:
TANQUEO- Regular fuel refill (default)ANTICIPO- Advance payment
Optional notes or observations
Available balance at fuel station after this transaction
TANQUEO-Specific Fields
Required whentipo_operacion = "TANQUEO":
Driver identifier (must exist in
areas_conductores table)Vehicle plate identifier (must exist in
areas_placas table)Fuel type:
ACPM- Diesel (default)GASOLINA- Regular gasolineEXTRA- Premium gasoline
Total fuel cost in COP (Colombian Pesos)
Quantity of fuel in gallons
Hourmeter reading at time of refueling (recommended for tracking)
ANTICIPO-Specific Fields
Required whentipo_operacion = "ANTICIPO":
Advance payment amount in COP
Response
Returns the created fuel record with all fields including auto-generated values.Unique identifier for the created record
Transaction date
Driver identifier (null for ANTICIPO)
Vehicle plate identifier (null for ANTICIPO)
Fuel station identifier
Operational area identifier
Fuel type (null for ANTICIPO)
Total fuel cost (null for ANTICIPO)
Fuel quantity in gallons (null for ANTICIPO)
Automatically calculated cost per gallon (valor_tanqueo / cantidad_galones)
Hourmeter reading
Advance payment amount (null for TANQUEO)
Available balance at fuel station
Concept: OPERATIVO or ADMINISTRATIVO
Operation type: TANQUEO or ANTICIPO
Observations or notes
User ID who created the record
Examples
Create Regular Fuel Refill (TANQUEO)
Create Advance Payment (ANTICIPO)
Create with Minimal Fields
Success Response Example
Status Code:201 Created
Validation Rules
Automatic Calculations
- costo_por_galon: Automatically calculated as
valor_tanqueo / cantidad_galoneswhen both values are provided andcantidad_galones > 0 - creado_por: Automatically set to the authenticated user’s ID from the JWT token
Type-Specific Validation
For TANQUEO operations:conductor_id,placa_id,tipo_combustible,valor_tanqueo, andcantidad_galonesare requiredvalor_anticipomust be null or omitted
valor_anticipois required- Vehicle and driver fields (
conductor_id,placa_id,tipo_combustible,valor_tanqueo,cantidad_galones) must be null or omitted
Date Format
fechamust be in ISO format:YYYY-MM-DD- Future dates are allowed (for scheduled transactions)
Numeric Fields
- All monetary values should be in Colombian Pesos (COP)
cantidad_galonesaccepts decimal values (e.g., 12.5)horometroaccepts decimal values for precise tracking
Error Responses
400 Bad Request - Missing Required Fields
400 Bad Request - Invalid Foreign Key
400 Bad Request - Invalid Data Type
401 Unauthorized
500 Internal Server Error
Implementation Notes
- The endpoint writes to the
tanqueotable (not thetanqueo_relacionesview) - Foreign key constraints ensure referential integrity with related tables
- The authenticated user’s ID from the JWT token is automatically recorded in
creado_por - Cost per gallon is automatically calculated server-side to ensure consistency
- Default values are applied for optional fields (
conceptodefaults to “OPERATIVO”,tipo_combustibledefaults to “ACPM”)
Related Endpoints
- Update Fuel Record - Modify an existing record
- List Fuel Records - View all records
- Import Fuel Records - Bulk import multiple records