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

# Lead versions

> Find and query paginated versions of Leads

<Accordion title="Usage with the Drivly SDK" icon="code-simple">
  <Note>
    <span class="font-medium">Make sure you install our SDK first. You can find out how, and more [here](/commerce/sdk).</span>
  </Note>

  ```typescript theme={null}
  import { SDK } from '@drivly/commerce'
  import type { leads } from '@drivly/commerce'

  const sdk = new SDK(...)

  const leads = await sdk.leads.find(): Promise<leads[]>
  ```
</Accordion>


## OpenAPI

````yaml get /leads/versions
openapi: 3.0.3
info:
  title: Drivly Commerce API
  version: 1.0.0
  description: API for the Driv.ly experience
  contact:
    name: Drivly
    url: https://driv.ly
    email: support@driv.ly
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://commerce.driv.ly/api
security: []
paths:
  /leads/versions:
    get:
      tags:
        - leads
      summary: Lead versions
      description: Find and query paginated versions of Leads
      parameters:
        - name: depth
          in: query
          description: number of levels to automatically populate relationships and uploads
          schema:
            type: number
        - name: locale
          in: query
          description: retrieves document(s) in a specific locale
          schema:
            type: string
        - name: fallback-locale
          in: query
          description: specifies a fallback locale if no locale value exists
          schema:
            type: string
        - name: sort
          in: query
          description: sort by field
          schema:
            type: string
        - name: where
          in: query
          description: >-
            pass a where query to constrain returned documents (complex type,
            see documentation)
          style: deepObject
          explode: true
          allowReserved: true
          schema:
            $ref: '#/components/schemas/where'
        - name: limit
          in: query
          description: limit the returned documents to a certain number
          schema:
            type: number
        - name: page
          in: query
          description: get a specific page of documents
          schema:
            type: number
      responses:
        '200':
          $ref: '#/components/responses/leadsVersionsResponse'
      security:
        - apiKeyAuth: []
components:
  schemas:
    where:
      title: Where clause
      type: object
      additionalProperties:
        anyOf:
          - type: object
            properties:
              equals: {}
            additionalProperties: false
          - type: object
            properties:
              not_equals: {}
            additionalProperties: false
          - type: object
            properties:
              greater_than:
                anyOf:
                  - type: string
                  - type: number
            additionalProperties: false
          - type: object
            properties:
              greater_than_equal:
                anyOf:
                  - type: string
                  - type: number
            additionalProperties: false
          - type: object
            properties:
              less_than:
                anyOf:
                  - type: string
                  - type: number
            additionalProperties: false
          - type: object
            properties:
              less_than_equal:
                anyOf:
                  - type: string
                  - type: number
            additionalProperties: false
          - type: object
            properties:
              like:
                type: string
            additionalProperties: false
          - type: object
            properties:
              contains:
                type: string
            additionalProperties: false
          - type: object
            properties:
              in:
                type: string
            additionalProperties: false
          - type: object
            properties:
              not_in:
                type: string
            additionalProperties: false
          - type: object
            properties:
              exists:
                type: boolean
            additionalProperties: false
          - type: object
            properties:
              near:
                type: string
            additionalProperties: false
      properties:
        or:
          type: array
          items:
            title: Where clause
            type: object
            additionalProperties:
              anyOf:
                - type: object
                  properties: {}
                  additionalProperties: false
                - type: object
                  properties: {}
                  additionalProperties: false
                - type: object
                  properties:
                    greater_than:
                      anyOf:
                        - type: string
                        - type: number
                  additionalProperties: false
                - type: object
                  properties:
                    greater_than_equal:
                      anyOf:
                        - type: string
                        - type: number
                  additionalProperties: false
                - type: object
                  properties:
                    less_than:
                      anyOf:
                        - type: string
                        - type: number
                  additionalProperties: false
                - type: object
                  properties:
                    less_than_equal:
                      anyOf:
                        - type: string
                        - type: number
                  additionalProperties: false
                - type: object
                  properties:
                    like:
                      type: string
                  additionalProperties: false
                - type: object
                  properties:
                    contains:
                      type: string
                  additionalProperties: false
                - type: object
                  properties:
                    in:
                      type: string
                  additionalProperties: false
                - type: object
                  properties:
                    not_in:
                      type: string
                  additionalProperties: false
                - type: object
                  properties:
                    exists:
                      type: boolean
                  additionalProperties: false
                - type: object
                  properties:
                    near:
                      type: string
                  additionalProperties: false
            properties:
              or:
                type: array
              and:
                type: array
            example:
              or:
                - color:
                    equals: mint
                - and:
                    - color:
                        equals: white
                    - featured:
                        equals: false
        and:
          type: array
          items:
            title: Where clause
            type: object
            additionalProperties:
              anyOf:
                - type: object
                  properties: {}
                  additionalProperties: false
                - type: object
                  properties: {}
                  additionalProperties: false
                - type: object
                  properties:
                    greater_than:
                      anyOf:
                        - type: string
                        - type: number
                  additionalProperties: false
                - type: object
                  properties:
                    greater_than_equal:
                      anyOf:
                        - type: string
                        - type: number
                  additionalProperties: false
                - type: object
                  properties:
                    less_than:
                      anyOf:
                        - type: string
                        - type: number
                  additionalProperties: false
                - type: object
                  properties:
                    less_than_equal:
                      anyOf:
                        - type: string
                        - type: number
                  additionalProperties: false
                - type: object
                  properties:
                    like:
                      type: string
                  additionalProperties: false
                - type: object
                  properties:
                    contains:
                      type: string
                  additionalProperties: false
                - type: object
                  properties:
                    in:
                      type: string
                  additionalProperties: false
                - type: object
                  properties:
                    not_in:
                      type: string
                  additionalProperties: false
                - type: object
                  properties:
                    exists:
                      type: boolean
                  additionalProperties: false
                - type: object
                  properties:
                    near:
                      type: string
                  additionalProperties: false
            properties:
              or:
                type: array
              and:
                type: array
            example:
              or:
                - color:
                    equals: mint
                - and:
                    - color:
                        equals: white
                    - featured:
                        equals: false
      example:
        or:
          - color:
              equals: mint
          - and:
              - color:
                  equals: white
              - featured:
                  equals: false
    leadsVersions:
      type: object
      title: Lead versions
      properties:
        docs:
          type: array
          items:
            title: Lead version
            type: object
            additionalProperties: false
            properties:
              version:
                type: object
                additionalProperties: false
                properties:
                  processStatuses:
                    enum:
                      - Qualified Lead
                      - Actively Communicating
                      - First Communication Attempt (phone and text)
                      - Second Communication Attempt
                      - On Hold
                      - Lost
                    type: string
                    nullable: true
                  reason:
                    enum:
                      - Do Not Contact
                      - Duplicate
                      - Looking For Business Financing
                      - Looking For Listings
                      - Looking For Personal Financing
                      - Not Responding
                      - Test
                      - Bad Credit
                    type: string
                    nullable: true
                  latestEvent:
                    type: number
                    nullable: true
                  notes:
                    type: string
                    nullable: true
                  statusTracker:
                    type: string
                    nullable: true
                  searches:
                    items:
                      type: number
                    type: array
                    nullable: true
                  attachments:
                    type: string
                    nullable: true
                  firstName:
                    type: string
                    nullable: true
                  lastName:
                    type: string
                    nullable: true
                  phone:
                    type: string
                    nullable: true
                  call:
                    type: string
                    nullable: true
                  zipcode:
                    type: string
                    nullable: true
                  email:
                    type: string
                    nullable: true
                  loginEmail:
                    type: string
                    nullable: true
                  purchaseOption:
                    type: string
                    nullable: true
                  timeToPurchase:
                    items:
                      enum:
                        - ASAP
                        - This week
                        - Within 1-2 weeks
                        - Within 2-4 weeks
                        - Asap
                        - This Week
                        - Within 1-2 Weeks
                        - Within 2-4 Weeks
                        - within 1-2 weeks
                        - within 2-4 weeks
                        - within 1-2 months
                        - other
                        - this week
                        - asap
                        - 2+ months
                        - just browsing
                        - 1-2 months
                        - 1-2 weeks
                        - 2-4 weeks
                      type: string
                    type: array
                    nullable: true
                  monthlyPayment:
                    type: number
                    nullable: true
                  budgetLower:
                    type: string
                    nullable: true
                  budgetUpper:
                    type: string
                    nullable: true
                  mileageLower:
                    type: number
                    nullable: true
                  mileageUpper:
                    type: number
                    nullable: true
                  cashDown:
                    type: number
                    nullable: true
                  newOrUsed:
                    type: string
                    nullable: true
                  bodyStyle:
                    items:
                      enum:
                        - truck
                        - car
                        - van
                        - suv
                        - wagon
                      type: string
                    type: array
                    nullable: true
                  carStyle:
                    items:
                      enum:
                        - sedan
                        - coupe
                        - convertible
                        - hatchback
                      type: string
                    type: array
                    nullable: true
                  truckStyle:
                    items:
                      enum:
                        - crew
                        - reg
                        - extended
                      type: string
                    type: array
                    nullable: true
                  suvStyle:
                    items:
                      enum:
                        - small/compact
                        - mid-size
                        - large/full-size
                      type: string
                    type: array
                    nullable: true
                  vanStyle:
                    items:
                      enum:
                        - cargo
                        - passenger
                        - conversion
                      type: string
                    type: array
                    nullable: true
                  yearLower:
                    type: number
                    nullable: true
                  yearUpper:
                    type: number
                    nullable: true
                  year:
                    type: number
                    nullable: true
                  make:
                    type: string
                    nullable: true
                  model:
                    type: string
                    nullable: true
                  exterior:
                    items:
                      enum:
                        - Silver
                        - White
                        - Black
                        - Brown
                        - Blue
                        - Orange
                        - Red
                        - Green
                        - Any color
                        - Beige
                        - Gold
                        - Gray
                        - Light Blue
                      type: string
                    type: array
                    nullable: true
                  interior:
                    items:
                      enum:
                        - Black
                        - Gray
                        - Tan
                        - Beige
                        - Blue
                        - Brown
                        - Red
                        - White
                        - Any color
                        - Ivory
                        - Cream
                      type: string
                    type: array
                    nullable: true
                  fuelType:
                    items:
                      enum:
                        - Gasoline
                        - Electric
                        - Hybrid
                        - gasoline
                        - flex fuel
                        - diesel
                        - other
                        - hybrid
                        - electric
                      type: string
                    type: array
                    nullable: true
                  drivetrain:
                    items:
                      enum:
                        - Four Wheel Drive
                        - Rear Wheel Drive
                        - Front Wheel Drive
                        - all wheel drive
                        - front wheel drive
                        - rear wheel drive
                      type: string
                    type: array
                    nullable: true
                  transmission:
                    items:
                      enum:
                        - Automatic
                        - Manual
                        - automatic
                        - cvt
                        - manual
                      type: string
                    type: array
                    nullable: true
                  comfort:
                    items:
                      enum:
                        - Leather/premium Seats
                        - Heated Steering Wheel
                        - leather/premium seats
                        - heated steering wheel
                        - ventilated or cooled seats
                        - heated seats
                        - dual-zone/climate control
                        - power-adjustable seats
                        - noise-cancelling technology
                        - massage seats
                      type: string
                    type: array
                    nullable: true
                  safety:
                    items:
                      enum:
                        - Adaptive Cruise Control
                        - Blind Spot Monitor
                        - lane departure warning
                        - back up camera
                        - 360 camera
                        - park assist
                        - heads-up display
                        - adaptive cruise control
                        - blind spot monitor
                      type: string
                    type: array
                    nullable: true
                  entertainment:
                    items:
                      enum:
                        - Premium Audio System
                        - Entertainment Package/dvd
                        - premium audio system
                        - apple carplay/android auto
                        - bluetooth
                        - auxiliary input
                        - usb ports
                        - wireless device charging
                        - wi-fi hotspot
                        - navigation system
                        - entertainment package/dvd
                        - satellite radio
                      type: string
                    type: array
                    nullable: true
                  utility:
                    items:
                      enum:
                        - Towing Package
                        - Sunroof/moonroof/panoramic Roof
                        - towing package
                        - sunroof/moonroof/panoramic roof
                        - adaptive suspension
                        - 4 wheel drive
                        - 3rd row seats
                        - handicap accessible
                      type: string
                    type: array
                    nullable: true
                  subscribe:
                    type: boolean
                    nullable: true
                  agree:
                    type: boolean
                    nullable: true
                  customer:
                    type: string
                    nullable: true
                  messageNotifications:
                    type: boolean
                    nullable: true
                  emailNotifications:
                    type: boolean
                    nullable: true
                  emailAlerts:
                    type: boolean
                    nullable: true
                  emailOffers:
                    type: boolean
                    nullable: true
                  leadEvents:
                    items:
                      type: number
                    type: array
                    nullable: true
                  cfZipcode:
                    type: string
                    nullable: true
                  cfState:
                    type: string
                    nullable: true
                  cfCity:
                    type: string
                    nullable: true
                  completedDate:
                    type: string
                    nullable: true
                  localTime:
                    type: string
                    nullable: true
                  trade:
                    items:
                      type: number
                    type: array
                    nullable: true
                  messages:
                    items:
                      type: number
                    type: array
                    nullable: true
                  creditScore:
                    type: string
                    nullable: true
                  contactScore:
                    type: string
                    nullable: true
                  contactBelongsTo:
                    type: string
                    nullable: true
                  contactType:
                    type: string
                    nullable: true
                  contactValid:
                    type: boolean
                    nullable: true
                  testingCustomer:
                    type: boolean
                    nullable: true
                  estimatedAgeRange:
                    type: string
                    nullable: true
                  estimatedAddress:
                    type: string
                    nullable: true
                  estimatedZipcode:
                    type: string
                    nullable: true
                  meetings:
                    items:
                      type: number
                    type: array
                    nullable: true
                  makeAndModel:
                    type: string
                    nullable: true
                  conversation:
                    type: string
                    nullable: true
                  city:
                    type: string
                    nullable: true
                  state:
                    type: string
                    nullable: true
                  preApprovalId:
                    type: string
                    nullable: true
                  vdpEmails:
                    items:
                      type: number
                    type: array
                    nullable: true
                  favorites:
                    items:
                      type: number
                    type: array
                    nullable: true
                  calls:
                    items:
                      type: number
                    type: array
                    nullable: true
                  salesRep:
                    type: number
                    nullable: true
                  preApprovals:
                    items:
                      type: number
                    type: array
                    nullable: true
                  anonymousId:
                    type: string
                    nullable: true
                  manual:
                    type: boolean
                    nullable: true
                  trim:
                    type: string
                    nullable: true
                  oneOwner:
                    type: boolean
                    nullable: true
                  customers:
                    type: number
                    nullable: true
                required:
                  - createdAt
              createdAt:
                type: string
              updatedAt:
                type: string
            required:
              - id
              - parent
              - version
              - createdAt
              - updatedAt
        totalDocs:
          type: number
        limit:
          type: number
        totalPages:
          type: number
        page:
          type: number
        pagingCounter:
          type: number
        hasPrevPage:
          type: boolean
        hasNextPage:
          type: boolean
        prevPage:
          type: number
        nextPage:
          type: number
      required:
        - docs
        - totalDocs
        - limit
        - totalPages
        - page
        - pagingCounter
        - hasPrevPage
        - hasNextPage
  responses:
    leadsVersionsResponse:
      description: ok
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/leadsVersions'
  securitySchemes:
    apiKeyAuth:
      in: header
      type: apiKey
      name: Authorization

````