cURL
# Agent endpoints require HMAC-SHA256 signing. See
# /get-started/authentication for the full payload + headers spec, or use
# the @relayerfi/agent-sdk which signs automatically.
curl -X POST https://api.relayer.fi/v1/agents/events/batch \
-H "x-agent-id: $AGENT_ID" \
-H "x-agent-auth: $HMAC_SIGNATURE_HEX" \
-H "x-request-timestamp: $UNIX_TS" \
-H "Content-Type: application/json" \
-d '{
"events": [
{ "type": "llm_call", "tokens": 1234, "cost_usd": "0.018" },
{ "type": "api_call", "endpoint": "https://example/api", "cost_usd": "0.001" },
{ "type": "payment", "amount": "5.00", "currency": "USDC", "to": "skill_xyz" }
]
}'import { RelayerSDK } from "@relayerfi/agent-sdk";
const sdk = new RelayerSDK({ /* ... */ });
// The SDK batches automatically. Manual flush:
sdk.emitEvent({ type: "llm_call", tokens: 1234, cost_usd: "0.018" });
sdk.emitEvent({ type: "api_call", endpoint: "https://example/api", cost_usd: "0.001" });
sdk.emitEvent({ type: "payment", amount: "5.00", currency: "USDC", to: "skill_xyz" });
// EventBatcher flushes every 10s by default (configurable).
// Up to 100 events per batch. Selective retry: 429/5xx retried, 4xx dropped.import requests
url = "https://testnet.relayer.fi/v1/agents/events/batch"
payload = { "events": [
{
"type": "llm_call",
"amount": 123,
"recipient": "<string>",
"metadata": {}
}
] }
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({events: [{type: 'llm_call', amount: 123, recipient: '<string>', metadata: {}}]})
};
fetch('https://testnet.relayer.fi/v1/agents/events/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://testnet.relayer.fi/v1/agents/events/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([
'events' => [
[
'type' => 'llm_call',
'amount' => 123,
'recipient' => '<string>',
'metadata' => [
]
]
]
]),
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://testnet.relayer.fi/v1/agents/events/batch"
payload := strings.NewReader("{\n \"events\": [\n {\n \"type\": \"llm_call\",\n \"amount\": 123,\n \"recipient\": \"<string>\",\n \"metadata\": {}\n }\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://testnet.relayer.fi/v1/agents/events/batch")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"type\": \"llm_call\",\n \"amount\": 123,\n \"recipient\": \"<string>\",\n \"metadata\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.relayer.fi/v1/agents/events/batch")
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 \"events\": [\n {\n \"type\": \"llm_call\",\n \"amount\": 123,\n \"recipient\": \"<string>\",\n \"metadata\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyRuntime (HMAC)
Batch ingest agent events (up to 100)
<!-- relayer:auth-badge:start -->
> **Auth: agent HMAC.** Called by the agent SDK at runtime with `x-agent-id`, `x-agent-auth`, `x-request-timestamp` headers. **Not callable from backend ApiKey.** See [Authentication → Agent HMAC](/get-started/authentication).
<!-- relayer:auth-badge:end -->
POST
/
agents
/
events
/
batch
cURL
# Agent endpoints require HMAC-SHA256 signing. See
# /get-started/authentication for the full payload + headers spec, or use
# the @relayerfi/agent-sdk which signs automatically.
curl -X POST https://api.relayer.fi/v1/agents/events/batch \
-H "x-agent-id: $AGENT_ID" \
-H "x-agent-auth: $HMAC_SIGNATURE_HEX" \
-H "x-request-timestamp: $UNIX_TS" \
-H "Content-Type: application/json" \
-d '{
"events": [
{ "type": "llm_call", "tokens": 1234, "cost_usd": "0.018" },
{ "type": "api_call", "endpoint": "https://example/api", "cost_usd": "0.001" },
{ "type": "payment", "amount": "5.00", "currency": "USDC", "to": "skill_xyz" }
]
}'import { RelayerSDK } from "@relayerfi/agent-sdk";
const sdk = new RelayerSDK({ /* ... */ });
// The SDK batches automatically. Manual flush:
sdk.emitEvent({ type: "llm_call", tokens: 1234, cost_usd: "0.018" });
sdk.emitEvent({ type: "api_call", endpoint: "https://example/api", cost_usd: "0.001" });
sdk.emitEvent({ type: "payment", amount: "5.00", currency: "USDC", to: "skill_xyz" });
// EventBatcher flushes every 10s by default (configurable).
// Up to 100 events per batch. Selective retry: 429/5xx retried, 4xx dropped.import requests
url = "https://testnet.relayer.fi/v1/agents/events/batch"
payload = { "events": [
{
"type": "llm_call",
"amount": 123,
"recipient": "<string>",
"metadata": {}
}
] }
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({events: [{type: 'llm_call', amount: 123, recipient: '<string>', metadata: {}}]})
};
fetch('https://testnet.relayer.fi/v1/agents/events/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://testnet.relayer.fi/v1/agents/events/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([
'events' => [
[
'type' => 'llm_call',
'amount' => 123,
'recipient' => '<string>',
'metadata' => [
]
]
]
]),
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://testnet.relayer.fi/v1/agents/events/batch"
payload := strings.NewReader("{\n \"events\": [\n {\n \"type\": \"llm_call\",\n \"amount\": 123,\n \"recipient\": \"<string>\",\n \"metadata\": {}\n }\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://testnet.relayer.fi/v1/agents/events/batch")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"type\": \"llm_call\",\n \"amount\": 123,\n \"recipient\": \"<string>\",\n \"metadata\": {}\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.relayer.fi/v1/agents/events/batch")
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 \"events\": [\n {\n \"type\": \"llm_call\",\n \"amount\": 123,\n \"recipient\": \"<string>\",\n \"metadata\": {}\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyBody
application/json
Maximum array length:
100Show child attributes
Show child attributes
Response
Events recorded successfully
⌘I