Skip to main content
POST
/
create-events
Create Events
curl --request POST \
  --url 'https://api.depict.ai/create-events?api_key=' \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "tenant": "<string>",
    "market": "<string>",
    "deduplication_id": "<string>",
    "user_id": "<string>",
    "session_id": "<string>",
    "dsid": "<string>",
    "ab_test_group": "<string>",
    "product_id": "<string>",
    "variant_ids": [
      "<string>"
    ],
    "entity_identifiers": {},
    "url": "<string>",
    "entity_price": "<string>",
    "currency": "<string>",
    "document_referrer": "<string>",
    "document_width": "<string>",
    "attribution_id": "<string>",
    "recommendation_id": "<string>",
    "search_result_id": "<string>",
    "product_listing_result_id": "<string>",
    "click_location": "<string>",
    "page_url": "<string>",
    "recommendation_type": "<string>"
  }
]
'
import requests

url = "https://api.depict.ai/create-events?api_key="

payload = [
{
"tenant": "<string>",
"market": "<string>",
"deduplication_id": "<string>",
"user_id": "<string>",
"session_id": "<string>",
"dsid": "<string>",
"ab_test_group": "<string>",
"product_id": "<string>",
"variant_ids": ["<string>"],
"entity_identifiers": {},
"url": "<string>",
"entity_price": "<string>",
"currency": "<string>",
"document_referrer": "<string>",
"document_width": "<string>",
"attribution_id": "<string>",
"recommendation_id": "<string>",
"search_result_id": "<string>",
"product_listing_result_id": "<string>",
"click_location": "<string>",
"page_url": "<string>",
"recommendation_type": "<string>"
}
]
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([
{
tenant: '<string>',
market: '<string>',
deduplication_id: '<string>',
user_id: '<string>',
session_id: '<string>',
dsid: '<string>',
ab_test_group: '<string>',
product_id: '<string>',
variant_ids: ['<string>'],
entity_identifiers: {},
url: '<string>',
entity_price: '<string>',
currency: '<string>',
document_referrer: '<string>',
document_width: '<string>',
attribution_id: '<string>',
recommendation_id: '<string>',
search_result_id: '<string>',
product_listing_result_id: '<string>',
click_location: '<string>',
page_url: '<string>',
recommendation_type: '<string>'
}
])
};

fetch('https://api.depict.ai/create-events?api_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.depict.ai/create-events?api_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
[
'tenant' => '<string>',
'market' => '<string>',
'deduplication_id' => '<string>',
'user_id' => '<string>',
'session_id' => '<string>',
'dsid' => '<string>',
'ab_test_group' => '<string>',
'product_id' => '<string>',
'variant_ids' => [
'<string>'
],
'entity_identifiers' => [

],
'url' => '<string>',
'entity_price' => '<string>',
'currency' => '<string>',
'document_referrer' => '<string>',
'document_width' => '<string>',
'attribution_id' => '<string>',
'recommendation_id' => '<string>',
'search_result_id' => '<string>',
'product_listing_result_id' => '<string>',
'click_location' => '<string>',
'page_url' => '<string>',
'recommendation_type' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.depict.ai/create-events?api_key="

payload := strings.NewReader("[\n {\n \"tenant\": \"<string>\",\n \"market\": \"<string>\",\n \"deduplication_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"dsid\": \"<string>\",\n \"ab_test_group\": \"<string>\",\n \"product_id\": \"<string>\",\n \"variant_ids\": [\n \"<string>\"\n ],\n \"entity_identifiers\": {},\n \"url\": \"<string>\",\n \"entity_price\": \"<string>\",\n \"currency\": \"<string>\",\n \"document_referrer\": \"<string>\",\n \"document_width\": \"<string>\",\n \"attribution_id\": \"<string>\",\n \"recommendation_id\": \"<string>\",\n \"search_result_id\": \"<string>\",\n \"product_listing_result_id\": \"<string>\",\n \"click_location\": \"<string>\",\n \"page_url\": \"<string>\",\n \"recommendation_type\": \"<string>\"\n }\n]")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.depict.ai/create-events?api_key=")
.header("Content-Type", "application/json")
.body("[\n {\n \"tenant\": \"<string>\",\n \"market\": \"<string>\",\n \"deduplication_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"dsid\": \"<string>\",\n \"ab_test_group\": \"<string>\",\n \"product_id\": \"<string>\",\n \"variant_ids\": [\n \"<string>\"\n ],\n \"entity_identifiers\": {},\n \"url\": \"<string>\",\n \"entity_price\": \"<string>\",\n \"currency\": \"<string>\",\n \"document_referrer\": \"<string>\",\n \"document_width\": \"<string>\",\n \"attribution_id\": \"<string>\",\n \"recommendation_id\": \"<string>\",\n \"search_result_id\": \"<string>\",\n \"product_listing_result_id\": \"<string>\",\n \"click_location\": \"<string>\",\n \"page_url\": \"<string>\",\n \"recommendation_type\": \"<string>\"\n }\n]")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.depict.ai/create-events?api_key=")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"tenant\": \"<string>\",\n \"market\": \"<string>\",\n \"deduplication_id\": \"<string>\",\n \"user_id\": \"<string>\",\n \"session_id\": \"<string>\",\n \"dsid\": \"<string>\",\n \"ab_test_group\": \"<string>\",\n \"product_id\": \"<string>\",\n \"variant_ids\": [\n \"<string>\"\n ],\n \"entity_identifiers\": {},\n \"url\": \"<string>\",\n \"entity_price\": \"<string>\",\n \"currency\": \"<string>\",\n \"document_referrer\": \"<string>\",\n \"document_width\": \"<string>\",\n \"attribution_id\": \"<string>\",\n \"recommendation_id\": \"<string>\",\n \"search_result_id\": \"<string>\",\n \"product_listing_result_id\": \"<string>\",\n \"click_location\": \"<string>\",\n \"page_url\": \"<string>\",\n \"recommendation_type\": \"<string>\"\n }\n]"

response = http.request(request)
puts response.read_body
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}

Authorizations

api_key
string
query
required

Headers

referer
string
user-agent
string
x-forwarded-for
string
x-forwarded-host
string

Body

application/json
tenant
string
required

Identifier associated with the API integration

market
string
required

Market identifier

type
enum<string>
required

Type of event

Available options:
page_view,
click,
add_to_cart,
purchase,
element_visible,
ws_click,
recommendations_inserted
deduplication_id
string | null

If retrying creating events, this should be set to a unique value common across all requests with the same event

user_id
string | null

Customer identifier

session_id
string | null

Session identifier

dsid
string | null

Populated for integrations performed by Depict.ai only. Depict.ai Session Id

Minimum string length: 1
ab_test_group
string | null

A/B test group identifier. Not required.

product_id
string | null

Main product identifier

variant_ids
string[] | null

Identifiers of variants for this product. Not required.

entity_identifiers
Entity Identifiers · object | null

Key-value object containing additional identifiers for the product

url
string | null

The value of document.location.href in the user's browser

entity_price
string | null

Current price of product. Not required.

currency
string | null

Currency of product (ISO 4217 code). Not required.

document_referrer
string | null

The value of document.referrer in the user's browser

document_width
string | null

The value of document.width in the user's browser

attribution_id
string | null

Keyword specifying what led to this event. Not required.

recommendation_id
string | null

Unique identifier returned from the /recommend endpoint

search_result_id
string | null

Unique identifier of the search result.

product_listing_result_id
string | null

Unique identifier of the product listing result.

click_location
string | null

Keyword specifying what element was clicked. Not required.

page_url
string | null

The URL of the product page visited

recommendation_type
string | null

The type of recommendations inserted

Response

Successful Response