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

# Create truck

> Creates a new truck with the provided details, including make, model, year, plate number, unit number, VIN, state, ownership, and optional fields such as status, driver assignments, and warranty information.



## OpenAPI

````yaml POST /trucks/create/
openapi: 3.0.1
info:
  title: OpenAPI Datatruck
  description: >-
    To be able to use Datatruck OpenAPI you should create tokens from your
    dashboard. Go to your dashboard and create token with appropriate scopes and
    expiration. Expiration and scopes are optional as well as description for
    your token, but remember name is required.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://{company}.datatruck.io/api/v1/openapi/
security: []
paths:
  /trucks/create/:
    post:
      summary: Create Truck
      description: >-
        Creates a new truck with the provided details, including make, model,
        year, plate number, unit number, VIN, state, ownership, and optional
        fields such as status, driver assignments, and warranty information.
      operationId: createTruck
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTruckRequest'
      responses:
        '201':
          description: Truck successfully created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateTruckResponse'
        '400':
          description: Invalid request data.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateTruckRequest:
      type: object
      properties:
        make:
          type: string
          description: Manufacturer of the truck.
        model:
          type: string
          description: Model of the truck.
        year:
          type: integer
          description: Manufacturing year of the truck.
        plate_number:
          type: string
          description: Plate number of the truck.
        unit_number:
          type: string
          description: Unit number of the truck.
        vin:
          type: string
          description: Vehicle Identification Number (VIN) of the truck.
        state:
          type: string
          description: State where the truck is registered.
        ownership:
          type: string
          description: Ownership details of the truck.
        status:
          type: string
          description: Current status of the truck, if applicable.
        company_mc:
          type: integer
          nullable: true
          description: Company motor carrier number, if applicable.
        notes:
          type: string
          nullable: true
          description: Additional notes about the truck, if provided.
        driver_operator:
          type: integer
          nullable: true
          description: ID of the primary driver operator assigned to the truck, if any.
        co_driver_operator:
          type: integer
          nullable: true
          description: ID of the co-driver operator assigned to the truck, if any.
        reg_expiry_date:
          type: string
          format: date
          nullable: true
          description: Registration expiry date of the truck, if provided.
        last_annual_inspection_date:
          type: string
          format: date
          nullable: true
          description: Date of the last annual inspection, if provided.
        odometer:
          type: number
          format: float
          default: 0
          description: Current odometer reading of the truck.
        color:
          type: string
          nullable: true
          description: Color of the truck, if provided.
        dimensions:
          type: string
          nullable: true
          description: Dimensions of the truck, if provided.
        integration_eld:
          type: string
          nullable: true
          description: Electronic Logging Device (ELD) integration details, if provided.
        integration_id:
          type: string
          nullable: true
          description: Integration ID for the truck, if provided.
        integration_api:
          type: string
          nullable: true
          description: Integration API details for the truck, if provided.
        owner:
          type: integer
          nullable: true
          description: ID of the owner of the truck, if applicable.
        vendor:
          type: string
          nullable: true
          description: Vendor of the truck, if provided.
        seller:
          type: string
          nullable: true
          description: Seller of the truck, if provided.
        ownership_pickup_odometer:
          type: number
          format: float
          default: 0
          description: Odometer reading at the time of ownership pickup.
        ownership_pickup_date:
          type: string
          format: date
          nullable: true
          description: Date of ownership pickup, if provided.
        primary_warranty:
          type: string
          format: date
          nullable: true
          description: Primary warranty expiry date, if provided.
        secondary_warranty:
          type: string
          format: date
          nullable: true
          description: Secondary warranty expiry date, if provided.
      required:
        - make
        - model
        - year
        - plate_number
        - unit_number
        - vin
        - state
        - ownership
    CreateTruckResponse:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier of the created truck.
        unit_number:
          type: string
        plate_number:
          type: string
        vin:
          type: string
        make:
          type: string
        model:
          type: string
        year:
          type: integer
        status:
          type: string
        state:
          type: string
      required:
        - id
        - unit_number
        - plate_number
        - vin
        - make
        - model
        - year
        - status
        - state
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string

````