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

# Create Events

<Warning>
  This page does not apply to installs made in 2025 or later of the Depict Shopify apps
</Warning>


## OpenAPI

````yaml post /create-events
openapi: 3.1.0
info:
  title: Depict API
  version: '1.0'
servers: []
security: []
paths:
  /create-events:
    post:
      tags:
        - Events (v2)
      summary: Create Events
      description: >-
        There are 5 types of events:

        - page_view

        - click

        - add_to_cart

        - purchase

        - element_visible


        For most integrations, we recommend sending `add_to_cart` events. Note
        that most of the event fields are not mandatory.

        See more details about each event field below.


        For events of type `click` the `recommendation_id` for the clicked
        recommendation (which is returned from the `/recommend` endpoint)

        should be set if available.



        Examples requests:


        <pre>

        [{
            "tenant": "my_store",
            "market": "us",
            <mark>"type": "page_view",</mark>
            "user_id": "GA1.2.00000000.0000000000",
            "url": "https://my_store.com/awesome_mechanical_keyboard.html",
            "product_id": "BLA-KEY-XXX",
            "entity_identifiers": {
                "sku": "31415"
            },
            "entity_price": "100$",
            "document_width": "300"
        }]

        </pre>

        <pre>

        [{
            "tenant": "my_store",
            "market": "us",
            <mark>"type": "click",</mark>
            "user_id": "ga1.2.00000000.0000000000",
            "url": "https://my_store.com/awesome_mechanical_keyboard.html",
            "product_id": "bla-key-xxx",
            "entity_identifiers": {
                "sku": "31415"
            },
            "entity_price": "100$",
            "document_width": "300",
            <mark>"recommendation_id": "827ada29-92e7-4642-8805-8b7105a9c8a5",</mark>
            <mark>"click_location": "landing_page_recommendation_1"</mark>
        }]

        </pre>



        <details>
          <summary>View more examples</summary>
        <pre>

        [{
            "tenant": "my_store",
            "market": "us",
            <mark>"type": "add_to_cart",</mark>
            "user_id": "GA1.2.00000000.0000000000",
            "url": "https://my_store.com/awesome_mechanical_keyboard.html",
            "product_id": "BLA-KEY-XXX",
            "entity_identifiers": {
                "sku": "31415"
            },
            "entity_price": "100$",
            "document_width": "300"
        }]

        </pre>

        <pre>

        [{
            "tenant": "my_store",
            "market": "us",
            <mark>"type": "purchase",</mark>
            "user_id": "GA1.2.00000000.0000000000",
            "url": "https://my_store.com/checkout.html",
            "product_id": "BLA-KEY-XXX",
            "entity_identifiers": {
                "sku": "31415"
            },
            "entity_price": "100$",
            "document_width": "300"
        }]

        </pre>

        <pre>

        [{
            "tenant": "my_store",
            "market": "us",
            <mark>"type": "element_visible",</mark>
            "user_id": "GA1.2.00000000.0000000000",
            "url": "https://my_store.com/checkout.html",
            "product_id": "BLA-KEY-XXX",
            "entity_identifiers": {
                "sku": "31415"
            },
            "entity_price": "100$",
            "document_width": "300",
            <mark>"recommendation_id": "827ada29-92e7-4642-8805-8b7105a9c8a5"</mark>
        }]

        </pre>

        </details>
      operationId: create_events_create_events_post
      parameters:
        - name: referer
          in: header
          required: false
          schema:
            type: string
            title: Referer
        - name: user-agent
          in: header
          required: false
          schema:
            type: string
            title: User-Agent
        - name: x-forwarded-for
          in: header
          required: false
          schema:
            type: string
            title: X-Forwarded-For
        - name: x-forwarded-host
          in: header
          required: false
          schema:
            type: string
            title: X-Forwarded-Host
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Event'
              title: Request
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyQuery: []
        - APIKeyHeader: []
        - APIKeyCookie: []
components:
  schemas:
    Event:
      properties:
        tenant:
          type: string
          title: Tenant
          description: Identifier associated with the API integration
        market:
          type: string
          title: Market
          description: Market identifier
        deduplication_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Deduplication Id
          description: >-
            If retrying creating events, this should be set to a unique value
            common across all requests with the same event
        type:
          allOf:
            - $ref: '#/components/schemas/EEventType'
          description: Type of event
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: Customer identifier
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
          description: Session identifier
        dsid:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          title: Dsid
          description: >-
            Populated for integrations performed by Depict.ai only. Depict.ai
            Session Id
        ab_test_group:
          anyOf:
            - type: string
            - type: 'null'
          title: Ab Test Group
          description: A/B test group identifier. Not required.
        product_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Product Id
          description: Main product identifier
        variant_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Variant Ids
          description: Identifiers of variants for this product. Not required.
        entity_identifiers:
          anyOf:
            - additionalProperties:
                type: string
              type: object
            - type: 'null'
          title: Entity Identifiers
          description: Key-value object containing additional identifiers for the product
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: The value of `document.location.href` in the user's browser
        entity_price:
          anyOf:
            - type: string
            - type: 'null'
          title: Entity Price
          description: Current price of product. Not required.
        currency:
          anyOf:
            - type: string
            - type: 'null'
          title: Currency
          description: Currency of product (ISO 4217 code). Not required.
        document_referrer:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Referrer
          description: The value of `document.referrer` in the user's browser
        document_width:
          anyOf:
            - type: string
            - type: 'null'
          title: Document Width
          description: The value of `document.width` in the user's browser
        attribution_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Attribution Id
          description: Keyword specifying what led to this event. Not required.
        recommendation_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Recommendation Id
          description: Unique identifier returned from the `/recommend` endpoint
        search_result_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Search Result Id
          description: Unique identifier of the search result.
        product_listing_result_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Product Listing Result Id
          description: Unique identifier of the product listing result.
        click_location:
          anyOf:
            - type: string
            - type: 'null'
          title: Click Location
          description: Keyword specifying what element was clicked. Not required.
        page_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Page Url
          description: The URL of the product page visited
        recommendation_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Recommendation Type
          description: The type of recommendations inserted
      additionalProperties: false
      type: object
      required:
        - tenant
        - market
        - type
      title: Event
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EEventType:
      type: string
      enum:
        - page_view
        - click
        - add_to_cart
        - purchase
        - element_visible
        - ws_click
        - recommendations_inserted
      title: EEventType
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyQuery:
      type: apiKey
      in: query
      name: api_key
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-KEY
    APIKeyCookie:
      type: apiKey
      in: cookie
      name: X-API-KEY

````