Import user events (CSV)
curl --request POST \
--url http://api.gu1.ai/batch-import/import/user-events \
--header 'Authorization: Bearer <token>'import requests
url = "http://api.gu1.ai/batch-import/import/user-events"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://api.gu1.ai/batch-import/import/user-events', 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 => "http://api.gu1.ai/batch-import/import/user-events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://api.gu1.ai/batch-import/import/user-events"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://api.gu1.ai/batch-import/import/user-events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/batch-import/import/user-events")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyAPI Reference
Import user events (CSV)
Upload a CSV and enqueue user-event batch import using a saved mapping β via the gu1 batch import API for high-volume data loading.
POST
/
batch-import
/
import
/
user-events
Import user events (CSV)
curl --request POST \
--url http://api.gu1.ai/batch-import/import/user-events \
--header 'Authorization: Bearer <token>'import requests
url = "http://api.gu1.ai/batch-import/import/user-events"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('http://api.gu1.ai/batch-import/import/user-events', 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 => "http://api.gu1.ai/batch-import/import/user-events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://api.gu1.ai/batch-import/import/user-events"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://api.gu1.ai/batch-import/import/user-events")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://api.gu1.ai/batch-import/import/user-events")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyEndpoint
POST https://api.gu1.ai/batch-import/import/user-events
Overview
Content-Type:multipart/form-data.
Permissions: events:create.
Authentication
Authorization: Bearer YOUR_API_KEY
Form fields
| Field | Required | Description |
|---|---|---|
file | Yes | CSV file |
mappingId | Yes | Mapping with target === user_event |
executeRules | No | true (default) or false |
withAutoEntity | No | true (default) or false |
batchErrorHandling | No | Row error policy β see below. Default continue_collect_errors when omitted. |
Row error policy (batchErrorHandling)
| Value | Behavior |
|---|---|
continue_collect_errors (default) | Valid rows are queued and imported. Rows that fail mapping validation (e.g. unmapped eventType) are recorded as preflight failures and appear in the job failures CSV. |
rollback_all | If any row fails mapping validation, the request returns 400 and no job is created. |
stop_keep_success | Like continue for preflight; during processing, the worker stops after the first runtime row failure. Events created before that point are kept. |
stopOnFirstError=true maps to stop_keep_success.
Limits
| Value | |
|---|---|
| Files per request | 1 CSV |
| Max rows per import | By plan β Bulk imports overview β Limits by plan |
| Server cap (optional) | USER_EVENT_BATCH_IMPORT_MAX_ROWS may lower the plan limit |
| Over limit | 400 TOO_MANY_ITEMS |
Success response
202 Accepted
{
"success": true,
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"totalItems": 1200,
"preflightFailures": 3,
"message": "User event import queued"
}
totalItemsβ valid rows queued + preflight failures (mapping errors skipped under continue policy).preflightFailuresβ rows that failed mapping validation before the worker ran (download failures CSV from unified history when the job completes).
Pre-job errors
| HTTP | error.code | When |
|---|---|---|
| 400 | VALIDATION_ERROR | rollback_all and one or more rows fail mapping (details: structured row errors) |
| 400 | NO_VALID_ROWS | Every row failed mapping under continue policy |
Was this page helpful?
βI