Skip to main content
POST
/
v1
/
public
/
retrievers
/
{public_name}
/
interactions
/
batch
Track Interaction Batch
curl --request POST \
  --url https://api.mixpeek.com/v1/public/retrievers/{public_name}/interactions/batch \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "interactions": [
    {
      "document_id": "<string>",
      "interaction_type": [],
      "position": 1,
      "execution_id": "exec_abc123xyz",
      "query_snapshot": {
        "text": "wireless headphones"
      },
      "document_score": 0.95,
      "result_set_size": 10,
      "session_id": "sess_abc123",
      "metadata": {}
    }
  ]
}
'
import requests

url = "https://api.mixpeek.com/v1/public/retrievers/{public_name}/interactions/batch"

payload = { "interactions": [
{
"document_id": "<string>",
"interaction_type": [],
"position": 1,
"execution_id": "exec_abc123xyz",
"query_snapshot": { "text": "wireless headphones" },
"document_score": 0.95,
"result_set_size": 10,
"session_id": "sess_abc123",
"metadata": {}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
interactions: [
{
document_id: '<string>',
interaction_type: [],
position: 1,
execution_id: 'exec_abc123xyz',
query_snapshot: {text: 'wireless headphones'},
document_score: 0.95,
result_set_size: 10,
session_id: 'sess_abc123',
metadata: {}
}
]
})
};

fetch('https://api.mixpeek.com/v1/public/retrievers/{public_name}/interactions/batch', 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.mixpeek.com/v1/public/retrievers/{public_name}/interactions/batch",
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([
'interactions' => [
[
'document_id' => '<string>',
'interaction_type' => [

],
'position' => 1,
'execution_id' => 'exec_abc123xyz',
'query_snapshot' => [
'text' => 'wireless headphones'
],
'document_score' => 0.95,
'result_set_size' => 10,
'session_id' => 'sess_abc123',
'metadata' => [

]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.mixpeek.com/v1/public/retrievers/{public_name}/interactions/batch"

payload := strings.NewReader("{\n \"interactions\": [\n {\n \"document_id\": \"<string>\",\n \"interaction_type\": [],\n \"position\": 1,\n \"execution_id\": \"exec_abc123xyz\",\n \"query_snapshot\": {\n \"text\": \"wireless headphones\"\n },\n \"document_score\": 0.95,\n \"result_set_size\": 10,\n \"session_id\": \"sess_abc123\",\n \"metadata\": {}\n }\n ]\n}")

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

req.Header.Add("Authorization", "Bearer <token>")
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.mixpeek.com/v1/public/retrievers/{public_name}/interactions/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"interactions\": [\n {\n \"document_id\": \"<string>\",\n \"interaction_type\": [],\n \"position\": 1,\n \"execution_id\": \"exec_abc123xyz\",\n \"query_snapshot\": {\n \"text\": \"wireless headphones\"\n },\n \"document_score\": 0.95,\n \"result_set_size\": 10,\n \"session_id\": \"sess_abc123\",\n \"metadata\": {}\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.mixpeek.com/v1/public/retrievers/{public_name}/interactions/batch")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"interactions\": [\n {\n \"document_id\": \"<string>\",\n \"interaction_type\": [],\n \"position\": 1,\n \"execution_id\": \"exec_abc123xyz\",\n \"query_snapshot\": {\n \"text\": \"wireless headphones\"\n },\n \"document_score\": 0.95,\n \"result_set_size\": 10,\n \"session_id\": \"sess_abc123\",\n \"metadata\": {}\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "status": 123,
  "error": {
    "message": "<string>",
    "type": "<string>",
    "code": "<string>",
    "details": {}
  },
  "success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

X-Session-ID
string | null
X-Public-API-Key
string | null

Path Parameters

public_name
string
required

Public name of the published retriever

Body

application/json

Request to track multiple interactions in batch.

interactions
PublicInteractionRequest · object[]
required

List of interactions to track (max 100 per batch)

Required array length: 1 - 100 elements

Response

Successful Response