> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unitedpetroleum.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Bulk create fuel entries

> Creates a single entry or an array of up to 1000 fuel entries for your organization. Every `vehicle_external_id` (when provided) must belong to the API key's org. Telemetry (trip, GPS message, odometer + position) is auto-matched best-effort for entries with a vehicle + `transaction_date`; pass `trip_external_id` / `matched_message_id` to skip matching for that entry.



## OpenAPI

````yaml /openapi.json post /fuel/entries/bulk
openapi: 3.1.0
info:
  title: United Logistics API
  version: 0.1.0
  description: >-
    Industry-grade public API for fleet, fuel, and toll operations. Every
    endpoint is scoped to the organization owning the API key. Authentication:
    bearer API key (`ulk_<prefix>_<secret>`). Rate limit: 60 requests/minute/key
    by default (override per key via the dashboard).
  contact:
    name: United Logistics Engineering
    email: sfuentes@assetmg.tech
servers:
  - url: https://app.unitedlogistics.com.do/api/v1
    description: Production
  - url: http://localhost:3000/api/v1
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /fuel/entries/bulk:
    post:
      tags:
        - Fuel
      summary: Bulk create fuel entries
      description: >-
        Creates a single entry or an array of up to 1000 fuel entries for your
        organization. Every `vehicle_external_id` (when provided) must belong to
        the API key's org. Telemetry (trip, GPS message, odometer + position) is
        auto-matched best-effort for entries with a vehicle +
        `transaction_date`; pass `trip_external_id` / `matched_message_id` to
        skip matching for that entry.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FuelEntryBulkImportRequest'
            examples:
              bulk:
                summary: Bulk array
                value:
                  - vehicle_number: L18N / L534991
                    product_name: Diesel Regular
                    product_type: Regular
                    gallons: 60.008
                    price_per_gallon: 224.8
                    transaction_date: '2026-02-26T03:15:47.000Z'
                    source: API
                    reference_id: '300030586'
                  - vehicle_number: T-114
                    product_name: Diesel Regular
                    product_type: Regular
                    gallons: 41.2
                    price_per_gallon: 224.8
                    transaction_date: '2026-02-26T05:02:11.000Z'
                    source: API
                    reference_id: '300030587'
      responses:
        '201':
          description: Imported
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FuelEntryBulkImportResponse'
              example:
                inserted: 2
                ids:
                  - 589c258d-4736-4b6f-876f-87835992191e
                  - 7b2a3d2c-6e88-4a4d-8e7b-2c7a1f5d83b9
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorObject'
              example:
                error:
                  code: bad_request
                  message: Invalid fuel entry payload.
                  details:
                    fieldErrors:
                      gallons:
                        - gallons must be greater than 0
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorObject'
              example:
                error:
                  code: unauthorized
                  message: API key missing or invalid.
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorObject'
              example:
                error:
                  code: forbidden
                  message: 'API key is missing required scope: fuel_entries:write.'
        '404':
          description: A referenced vehicle does not exist in this organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorObject'
              example:
                error:
                  code: not_found
                  message: El vehículo especificado no existe en esta organización.
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorObject'
              example:
                error:
                  code: too_many_requests
                  message: Rate limit exceeded.
      security:
        - ApiKeyAuth: []
components:
  schemas:
    FuelEntryBulkImportRequest:
      anyOf:
        - $ref: '#/components/schemas/CreateFuelEntryRequest'
        - type: array
          items:
            $ref: '#/components/schemas/CreateFuelEntryRequest'
          minItems: 1
          maxItems: 1000
    FuelEntryBulkImportResponse:
      type: object
      properties:
        inserted:
          type: integer
          description: Number of entries created.
          example: 42
        ids:
          type: array
          items:
            type: string
            format: uuid
          description: Ids of every created entry.
      required:
        - inserted
        - ids
    ErrorObject:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: unauthorized
            message:
              type: string
              example: Missing Authorization header.
            details: {}
          required:
            - code
            - message
      required:
        - error
    CreateFuelEntryRequest:
      type: object
      properties:
        vehicle_external_id:
          type:
            - integer
            - 'null'
          description: >-
            Provider vehicle id (legacy `vehicle_id`). Enables trip/GPS
            matching.
          example: 16056
        vehicle_number:
          type: string
          minLength: 1
          maxLength: 255
          description: Denormalized vehicle number/plate at the time of the refuel.
          example: L18N / L534991
        vehicle_name:
          type:
            - string
            - 'null'
          maxLength: 255
        driver_external_id:
          type:
            - integer
            - 'null'
        driver_key:
          type:
            - string
            - 'null'
          maxLength: 255
        name:
          type:
            - string
            - 'null'
          maxLength: 255
          description: Driver name (denormalized). Defaults to `Desconocido`.
          example: Juan Pérez
        product_id:
          type:
            - string
            - 'null'
          format: uuid
        product_name:
          type: string
          minLength: 1
          maxLength: 255
          example: Diesel Regular
        product_type:
          type: string
          minLength: 1
          maxLength: 255
          example: Regular
        vendor_id:
          type:
            - string
            - 'null'
          format: uuid
        vendor_name:
          type:
            - string
            - 'null'
          maxLength: 255
        vendor_address:
          type:
            - string
            - 'null'
          maxLength: 500
        gallons:
          type: number
          exclusiveMinimum: 0
          example: 60.008
        total_cost:
          type: number
          minimum: 0
          description: Transaction total; price_per_gallon is inferred when provided.
          example: 13489.8
        price_per_gallon:
          type: number
          minimum: 0
          example: 224.8
        odometer_reading:
          type: number
          minimum: 0
          example: 10997
        transaction_date:
          type:
            - string
            - 'null'
          format: date-time
          example: '2026-02-26T03:15:47.000Z'
        transaction_id:
          type:
            - string
            - 'null'
          maxLength: 255
        notes:
          type:
            - string
            - 'null'
          maxLength: 2000
        source:
          type:
            - string
            - 'null'
          enum:
            - API
            - manual
            - import
          description: >-
            Origin of the entry. `manual` for UI capture, `import` for bulk
            CSV/Excel, `API` for integrations. Legacy `ERM` is accepted and
            stored as `manual`.
          example: API
        reference_id:
          type:
            - string
            - 'null'
          maxLength: 255
        trip_external_id:
          type:
            - integer
            - 'null'
        matched_message_id:
          type:
            - integer
            - 'null'
        gps_odometer_reading:
          type:
            - number
            - 'null'
          minimum: 0
        karma_driver_id:
          type:
            - integer
            - 'null'
      required:
        - vehicle_number
        - product_name
        - product_type
        - gallons
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: ulk_<prefix>_<secret>
      description: >-
        Authorization: Bearer ulk_<prefix>_<secret>. Cree la clave en
        Configuración → API.

````