Send events in bulk
curl --request POST \
--url https://win.oneshotagent.com/v1/compute/{goalId}/events/bulkimport requests
url = "https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk', 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://win.oneshotagent.com/v1/compute/{goalId}/events/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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 := "https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk")
.asString();require 'uri'
require 'net/http'
url = URI("https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"accepted": 123,
"outcomes": {},
"refused": [
{}
]
}Working with a goal
Send events in bulk
Send up to 1,000 events to a goal’s cases in one request
POST
/
v1
/
compute
/
{goalId}
/
events
/
bulk
Send events in bulk
curl --request POST \
--url https://win.oneshotagent.com/v1/compute/{goalId}/events/bulkimport requests
url = "https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk', 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://win.oneshotagent.com/v1/compute/{goalId}/events/bulk",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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 := "https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk")
.asString();require 'uri'
require 'net/http'
url = URI("https://win.oneshotagent.com/v1/compute/{goalId}/events/bulk")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"accepted": 123,
"outcomes": {},
"refused": [
{}
]
}Every wallet’s goals run on the agent loop and can use cases.
Authentication
A signed write proof or an access token: see Authentication schemes.Request body
{
"events": [
{ "event_id": "inv-1001", "case_key": "shipment-1", "task": "Freight invoice 1001: 1,240.00 USD" },
{ "event_id": "inv-1002", "case_key": "shipment-2", "task": "Freight invoice 1002: 310.00 USD" }
]
}
event_id, case_key, task, budget_usdc, step_limit. An event_id sent before, in this request or an earlier one, is one event. Events are handled in order.
Response
202 with:
{ event_id, reason } for each event not taken, such as a case past the goal’s scoped units or a budget the goal cannot fund. Fix and send those again.Limits
60 requests per minute for each goal, separate from other routes’ limits. Over it,429 with Retry-After.
Errors
| Status | error | Meaning |
|---|---|---|
400 | invalid_request | Not 1 to 1,000 events, or an event is malformed. |
404 | not_found | No such goal for this agent. |
409 | goal_not_running, not_on_the_agent_loop, run_not_due | The goal takes no events now. |
429 | rate_limit_exceeded | 60 requests this minute for this goal. |