curl --request POST \
--url https://api.useaira.com/v1/events/ingest \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"events": [
{
"idempotencyKey": "123e4567-e89b-12d3-a456-426614174000",
"eventName": "api_request",
"customerExternalId": "cust_1234567890abcdef",
"properties": {
"value": 3600,
"endpoint": "/api/v1/users",
"method": "GET",
"status_code": 200
},
"occurredAt": "2024-01-01T12:00:00Z"
}
]
}
'import requests
url = "https://api.useaira.com/v1/events/ingest"
payload = { "events": [
{
"idempotencyKey": "123e4567-e89b-12d3-a456-426614174000",
"eventName": "api_request",
"customerExternalId": "cust_1234567890abcdef",
"properties": {
"value": 3600,
"endpoint": "/api/v1/users",
"method": "GET",
"status_code": 200
},
"occurredAt": "2024-01-01T12:00:00Z"
}
] }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
idempotencyKey: '123e4567-e89b-12d3-a456-426614174000',
eventName: 'api_request',
customerExternalId: 'cust_1234567890abcdef',
properties: {value: 3600, endpoint: '/api/v1/users', method: 'GET', status_code: 200},
occurredAt: '2024-01-01T12:00:00Z'
}
]
})
};
fetch('https://api.useaira.com/v1/events/ingest', 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.useaira.com/v1/events/ingest",
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([
'events' => [
[
'idempotencyKey' => '123e4567-e89b-12d3-a456-426614174000',
'eventName' => 'api_request',
'customerExternalId' => 'cust_1234567890abcdef',
'properties' => [
'value' => 3600,
'endpoint' => '/api/v1/users',
'method' => 'GET',
'status_code' => 200
],
'occurredAt' => '2024-01-01T12:00:00Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.useaira.com/v1/events/ingest"
payload := strings.NewReader("{\n \"events\": [\n {\n \"idempotencyKey\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"eventName\": \"api_request\",\n \"customerExternalId\": \"cust_1234567890abcdef\",\n \"properties\": {\n \"value\": 3600,\n \"endpoint\": \"/api/v1/users\",\n \"method\": \"GET\",\n \"status_code\": 200\n },\n \"occurredAt\": \"2024-01-01T12:00:00Z\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.useaira.com/v1/events/ingest")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"idempotencyKey\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"eventName\": \"api_request\",\n \"customerExternalId\": \"cust_1234567890abcdef\",\n \"properties\": {\n \"value\": 3600,\n \"endpoint\": \"/api/v1/users\",\n \"method\": \"GET\",\n \"status_code\": 200\n },\n \"occurredAt\": \"2024-01-01T12:00:00Z\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useaira.com/v1/events/ingest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"idempotencyKey\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"eventName\": \"api_request\",\n \"customerExternalId\": \"cust_1234567890abcdef\",\n \"properties\": {\n \"value\": 3600,\n \"endpoint\": \"/api/v1/users\",\n \"method\": \"GET\",\n \"status_code\": 200\n },\n \"occurredAt\": \"2024-01-01T12:00:00Z\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"message": "<string>",
"code": "<string>",
"details": [
{
"idempotencyKey": "<string>",
"errors": [
{
"message": "<string>"
}
]
}
]
}Ingest events
Ingests a batch of events. Each event is identified by its idempotencyKey: if no event exists for the key, version 1 is created; re-sending the key with unchanged properties (including properties.value) is a no-op; re-sending with changed properties records a new version that supersedes the previous one. Frozen fields (eventName, customerExternalId, occurredAt) must match the existing event or the request is rejected with ImmutableFieldChange. Validation and frozen-field checks apply across the whole batch — if any event is rejected, none are recorded.
curl --request POST \
--url https://api.useaira.com/v1/events/ingest \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"events": [
{
"idempotencyKey": "123e4567-e89b-12d3-a456-426614174000",
"eventName": "api_request",
"customerExternalId": "cust_1234567890abcdef",
"properties": {
"value": 3600,
"endpoint": "/api/v1/users",
"method": "GET",
"status_code": 200
},
"occurredAt": "2024-01-01T12:00:00Z"
}
]
}
'import requests
url = "https://api.useaira.com/v1/events/ingest"
payload = { "events": [
{
"idempotencyKey": "123e4567-e89b-12d3-a456-426614174000",
"eventName": "api_request",
"customerExternalId": "cust_1234567890abcdef",
"properties": {
"value": 3600,
"endpoint": "/api/v1/users",
"method": "GET",
"status_code": 200
},
"occurredAt": "2024-01-01T12:00:00Z"
}
] }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
idempotencyKey: '123e4567-e89b-12d3-a456-426614174000',
eventName: 'api_request',
customerExternalId: 'cust_1234567890abcdef',
properties: {value: 3600, endpoint: '/api/v1/users', method: 'GET', status_code: 200},
occurredAt: '2024-01-01T12:00:00Z'
}
]
})
};
fetch('https://api.useaira.com/v1/events/ingest', 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.useaira.com/v1/events/ingest",
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([
'events' => [
[
'idempotencyKey' => '123e4567-e89b-12d3-a456-426614174000',
'eventName' => 'api_request',
'customerExternalId' => 'cust_1234567890abcdef',
'properties' => [
'value' => 3600,
'endpoint' => '/api/v1/users',
'method' => 'GET',
'status_code' => 200
],
'occurredAt' => '2024-01-01T12:00:00Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.useaira.com/v1/events/ingest"
payload := strings.NewReader("{\n \"events\": [\n {\n \"idempotencyKey\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"eventName\": \"api_request\",\n \"customerExternalId\": \"cust_1234567890abcdef\",\n \"properties\": {\n \"value\": 3600,\n \"endpoint\": \"/api/v1/users\",\n \"method\": \"GET\",\n \"status_code\": 200\n },\n \"occurredAt\": \"2024-01-01T12:00:00Z\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.useaira.com/v1/events/ingest")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"idempotencyKey\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"eventName\": \"api_request\",\n \"customerExternalId\": \"cust_1234567890abcdef\",\n \"properties\": {\n \"value\": 3600,\n \"endpoint\": \"/api/v1/users\",\n \"method\": \"GET\",\n \"status_code\": 200\n },\n \"occurredAt\": \"2024-01-01T12:00:00Z\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useaira.com/v1/events/ingest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"idempotencyKey\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"eventName\": \"api_request\",\n \"customerExternalId\": \"cust_1234567890abcdef\",\n \"properties\": {\n \"value\": 3600,\n \"endpoint\": \"/api/v1/users\",\n \"method\": \"GET\",\n \"status_code\": 200\n },\n \"occurredAt\": \"2024-01-01T12:00:00Z\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{}{
"message": "<string>",
"code": "<string>",
"details": [
{
"idempotencyKey": "<string>",
"errors": [
{
"message": "<string>"
}
]
}
]
}Authorizations
API Key Authentication.
Body
An object containing an array of events to be ingested.
An array of events to be ingested. Each event represents an usage of a resource from a customer at a specific point in time.
1 - 10000 elementsShow child attributes
Show child attributes
Response
The request was successfully processed.
The response is of type object.