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

# Create a new Web Event



## OpenAPI

````yaml Commerce post /webevents
openapi: 3.1.0
info:
  title: Commerce
  version: '3.0'
  contact:
    email: samuel@driv.ly
    name: Samuel Lippert
    url: https://driv.ly/
  description: Drivly Commerce API
servers:
  - url: https://commerce.driv.ly/api
security: []
paths:
  /webevents:
    parameters:
      - schema:
          type: integer
        name: depth
        in: query
        required: false
        description: The number of levels of related objects to include in the response
    post:
      summary: Create a new Web Event
      operationId: post-webevent
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewWebEvent'
      responses:
        '200':
          description: Web Event Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/WebEvent'
                  success:
                    type: boolean
        '400':
          description: Missing Required Information
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
                examples:
                  - error:
                      code: 400
                      message: Missing Required Information
                    success: false
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
                examples:
                  - error:
                      code: 401
                      message: Unauthorized
                    success: false
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
                examples:
                  - error:
                      code: 429
                      message: Too Many Requests
                    success: false
components:
  schemas:
    NewWebEvent:
      $id: NewWebEvent
      title: Web Event
      examples:
        - id: wev_7h9k2j5s3d4f
          name: User Login
          account:
            id: acc_0jk3v58djsi1
            lead: Lead ID
            consumer:
              id: con_2k4jd93vsd82
              ssn: 123-45-6789
              email: example@example.com
              lastName: Doe
              birthDate: '1990-05-15'
              firstName: John
              phoneNumber: 555-0199
            anonymousIds:
              - anon_4598kdjv9390
              - anon_4598kdjv9391
          anonymousId: anon_4598kdjv9390
      properties:
        id:
          type: string
          description: Web Event is uniquely identified by id
        name:
          type: string
          description: Web Event has Name
        anonymousId:
          type: string
          description: Web Event was created by Anonymous ID
        account:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/Account'
          description: Web Event was created by Account
      type: object
      required:
        - name
    WebEvent:
      $id: WebEvent
      examples:
        - id: wev_7h9k2j5s3d4f
          name: User Login
          account:
            id: acc_0jk3v58djsi1
            lead: Lead ID
            consumer:
              id: con_2k4jd93vsd82
              ssn: 123-45-6789
              email: example@example.com
              lastName: Doe
              birthDate: '1990-05-15'
              firstName: John
              phoneNumber: 555-0199
            anonymousIds:
              - anon_4598kdjv9390
              - anon_4598kdjv9391
          anonymousId: anon_4598kdjv9390
      required:
        - id
        - name
      title: Web Event
      type: object
      properties:
        id:
          type: string
          description: Web Event is uniquely identified by id
        name:
          type: string
          description: Web Event has Name
        anonymousId:
          type: string
          description: Web Event was created by Anonymous ID
        account:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/Account'
          description: Web Event was created by Account
    ErrorModel:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: number
            message:
              type: string
        success:
          type: boolean
    Account:
      $id: Account
      examples:
        - id: acc_0jk3v58djsi1
          lead: Lead ID
          consumer: Consumer ID
          anonymousIds:
            - anon_4598kdjv9390
            - anon_4598kdjv9391
      required:
        - id
      title: Account
      type: object
      properties:
        id:
          type: string
          description: Account is uniquely identified by id
        consumer:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/Consumer'
          description: Consumer logs into Account
        lead:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/Lead'
          description: Lead logs into Account
        anonymousIds:
          type: array
          items:
            type: string
          description: Account was logged in to by Anonymous ID
    Consumer:
      $id: Consumer
      examples:
        - id: con_2k4jd93vsd82
          ssn: 123-45-6789
          email: john.doe@example.com
          lastName: Doe
          birthDate: '1984-09-20'
          firstName: John
          phoneNumber: 555-0199
      title: Consumer
      type: object
      properties:
        id:
          type: string
          description: Customer is uniquely identified by id
        addresses:
          type: array
          items:
            oneOf:
              - type: string
              - $ref: '#/components/schemas/Address'
          description: Customer is located at Addresses
        phoneNumbers:
          type: array
          items:
            type: string
            pattern: ^\+?1?[- ]?\(?([0-9]{3})\)?[- ]?([0-9]{3})-?([0-9]{4})$
          description: Customer has Phone Number
        birthDate:
          type: string
          format: date
          description: Consumer has Birth Date
        email:
          type: string
          format: idn-email
          description: Consumer has Email
        phoneNumber:
          type: string
          pattern: ^\+?1?[- ]?\(?([0-9]{3})\)?[- ]?([0-9]{3})-?([0-9]{4})$
          description: Consumer has Phone Number
        ssn:
          type: string
          description: Consumer has SSN
        lastName:
          type: string
          description: Consumer has Last Name
        firstName:
          type: string
          description: Consumer has First Name
      required:
        - birthDate
        - phoneNumber
        - lastName
        - firstName
        - id
    Lead:
      $id: Lead
      examples:
        - id: led_3k2jd9s8v2s4
          email: contact@example.com
          salesRep: SalesRep ID
          consumer: Consumer ID
          favorites:
            - Vehicle ID Number
          phoneNumber: 555-6789
          acceptsGeneratedMessages: true
      required:
        - id
        - phoneNumber
        - email
      title: Lead
      type: object
      properties:
        id:
          type: string
          description: Lead is uniquely identified by id
        salesRep:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/SalesRep'
          description: Sales Rep is assigned to Lead
        consumer:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/Consumer'
          description: Lead participates in transactions as Consumer
        phoneNumber:
          type: string
          pattern: ^\+?1?[- ]?\(?([0-9]{3})\)?[- ]?([0-9]{3})-?([0-9]{4})$
          description: Lead has Phone Number
        email:
          type: string
          format: idn-email
          description: Lead has Email
        favorites:
          type: array
          items:
            oneOf:
              - type: string
              - $ref: '#/components/schemas/Vehicle'
          description: Lead favorites Vehicle
        acceptsGeneratedMessages:
          type: boolean
          description: Lead accepts generated messages
    Address:
      $id: Address
      examples:
        - id: adr_2kj49d1msod2
          zip: '62704'
          city:
            name: Springfield
            state:
              code: IL
          line2: Apt 201
          line1: 456 Elm Street
      required:
        - id
        - city
        - zip
        - line1
      title: Address
      type: object
      properties:
        id:
          type: string
          description: Address is uniquely identified by id
        city:
          oneOf:
            - type: object
              properties:
                state:
                  oneOf:
                    - type: string
                    - $ref: '#/components/schemas/State'
                name:
                  type: string
              required:
                - state
                - name
            - $ref: '#/components/schemas/City'
          description: Address is located in City
        zip:
          type: string
          description: Address has ZIP
        line2:
          type: string
          description: Address has Address Line 2
        line1:
          type: string
          description: Address has Address Line 1
    SalesRep:
      $id: SalesRep
      examples:
        - id: srep_8f9v2j1kd92j
          emails:
            - sales.rep@example.com
            - contact@example.com
          lastName: Smith
          firstName: Alice
          templates:
            - Welcome Template
            - Follow-up Template
          creditBands:
            - Prime
            - Subprime
          primaryEmail: sales.rep@example.com
          phoneNumbers:
            - +1-555-0123
            - +1-555-0456
          primaryPhoneNumber: +1-555-0123
          isAcceptingNewLeads: true
      title: Sales Rep
      type: object
      properties:
        id:
          type: string
          description: Contact is uniquely identified by id
        agent:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/Agent'
          description: Contact is automated Agent
        address:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/Address'
          description: Contact has Address
        primaryPhoneNumber:
          type: string
          pattern: ^\+?1?[- ]?\(?([0-9]{3})\)?[- ]?([0-9]{3})-?([0-9]{4})$
          description: Contact has Primary Phone Number
        primaryEmail:
          type: string
          format: idn-email
          description: Contact has Primary Email
        lastName:
          type: string
          description: Contact has Last Name
        firstName:
          type: string
          description: Contact has First Name
        emails:
          type: array
          items:
            type: string
            format: idn-email
          description: Contact has Email
        phoneNumbers:
          type: array
          items:
            type: string
            pattern: ^\+?1?[- ]?\(?([0-9]{3})\)?[- ]?([0-9]{3})-?([0-9]{4})$
          description: Contact has Phone Number
        roles:
          type: array
          items:
            type: string
          description: Contact has Role
        creditBands:
          type: array
          items:
            oneOf:
              - type: string
              - $ref: '#/components/schemas/CreditBand'
          description: Sales Rep accepts leads from Credit Band
        templates:
          type: array
          items:
            oneOf:
              - type: string
              - $ref: '#/components/schemas/Template'
          description: Sales Rep uses Template
        isAcceptingNewLeads:
          type: boolean
          description: Sales Rep is accepting new leads
      required:
        - lastName
        - firstName
        - id
    Vehicle:
      $id: Vehicle
      examples:
        - vin: 1C4HJXEN5MW592818
          year: 2021
          make: Jeep
          trim: Sport
          spec: vs_4jf8x9jv5c0b
          model: Wrangler
          engine: 3.6L V6
          seatCount: 5
          doorCount: 4
          bodyStyle: SUV
          drivetrain: 4WD
          transmission: Automatic
          interiorColor: Black
          exteriorColor: Red
      required:
        - vin
        - year
        - make
        - transmission
        - engine
        - drivetrain
        - model
        - bodyStyle
      title: Vehicle
      type: object
      properties:
        vin:
          type: string
          description: Vehicle is uniquely identified by vin
        seatCount:
          type: integer
          minimum: 0
          description: Vehicle has Seat Count
        doorCount:
          type: integer
          minimum: 0
          description: Vehicle has Door Count
        interiorColor:
          type: string
          description: Vehicle was manufactured with Interior Color
        exteriorColor:
          type: string
          description: Vehicle was manufactured with Exterior Color
        year:
          type: integer
          description: Vehicle was manufactured in Year
        make:
          type: string
          description: Vehicle is of Make
        trim:
          type: string
          description: Vehicle has Trim level
        transmission:
          type: string
          description: Vehicle has Transmission
        engine:
          type: string
          description: Vehicle has Engine specification
        spec:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/VehicleSpec'
          description: Vehicle has Vehicle Spec
        drivetrain:
          type: string
          description: Vehicle has Drivetrain
        model:
          type: string
          description: Vehicle has Model
        bodyStyle:
          type: string
          description: Vehicle has Body Style
    State:
      $id: State
      title: State
      properties:
        code:
          type: string
          description: State is uniquely identified by State Code
      type: object
      required:
        - code
    City:
      $id: City
      examples:
        - name: Springfield
          state:
            code: IL
      required:
        - state
        - name
      title: City
      type: object
      properties:
        state:
          oneOf:
            - type: string
            - $ref: '#/components/schemas/State'
          description: City is uniquely identified by State
        name:
          type: string
          description: City is uniquely identified by Name
    Agent:
      $id: Agent
      examples:
        - id: ai_3jks93ndk3s9
          model: gpt-4o
          prompt: Respond to the customer service request
          functions:
            - fnc_ed904md03684
      required:
        - id
        - model
      title: Agent
      type: object
      properties:
        id:
          type: string
          description: Agent is uniquely identified by id
        prompt:
          type: string
          description: Agent has Prompt
        model:
          type: string
          description: Agent has Agent Model
        functions:
          type: array
          items:
            type: string
          description: Agent has Function
    CreditBand:
      $id: CreditBand
      title: Credit Band
      examples:
        - id: crb_39fjkd93nmd0
          name: Good
          isNS: false
          isPrime: true
          isUnknown: false
          minimumCreditScore: 600
          maximumCreditScore: 700
      properties:
        id:
          type: string
          description: Credit Band is uniquely identified by id
        minimumCreditScore:
          type: number
          description: Credit Band has Minimum Credit Score
        maximumCreditScore:
          type: number
          description: Credit Band has Maximum Credit Score
        name:
          type: string
          description: Credit Band has Name
        isUnknown:
          type: boolean
          description: Credit Band is unknown
        isNS:
          type: boolean
          description: Credit Band is NS
        isPrime:
          type: boolean
          description: Credit Band is prime
      type: object
      required:
        - id
        - name
    Template:
      $id: Template
      examples:
        - id: tmp_39fjkd93nmd0
          type: Email
          subject: Invoice Details
          messageText: Hello, please find your invoice attached.
      required:
        - id
        - type
        - messageText
      title: Template
      type: object
      properties:
        id:
          type: string
          description: Template is uniquely identified by id
        type:
          type: string
          description: Template has Template Type
        messageText:
          type: string
          description: Template has Message Text
        subject:
          type: string
          description: Template has Subject
    VehicleSpec:
      $id: VehicleSpec
      title: Vehicle Spec
      examples:
        - id: vs_4jf8x9jv5c0b
          make: Toyota
          year: 2022
          trim: SE
          model: Camry
          engine: 2.5L 4-cylinder
          squishVin: 4T1BF1FK5H
          bodyStyle: Sedan
          drivetrain: FWD
          transmission: Automatic
          exteriorColors:
            - Black
            - Silver
          interiorColors:
            - Black
            - Gray
      properties:
        id:
          type: string
          description: Vehicle Spec is uniquely identified by id
        model:
          type: string
          description: Vehicle Spec has Model
        make:
          type: string
          description: Vehicle Spec has Make
        squishVin:
          type: string
          minLength: 10
          maxLength: 10
          description: Vehicle Spec has Squish VIN
        year:
          type: integer
          description: Vehicle Spec has Year
        engine:
          type: string
          description: Vehicle Spec has Engine specifications
        drivetrain:
          type: string
          description: Vehicle Spec has Drivetrain
        bodyStyle:
          type: string
          description: Vehicle Spec has Body Style
        transmission:
          type: string
          description: Vehicle Spec has Transmission
        trim:
          type: string
          description: Vehicle Spec has Trim
        exteriorColors:
          type: array
          items:
            type: string
          description: Vehicle Spec has Exterior Color
        interiorColors:
          type: array
          items:
            type: string
          description: Vehicle Spec has Interior Color
      type: object
      required:
        - id
        - model
        - make
        - year
        - engine
        - drivetrain
        - bodyStyle
        - transmission

````