curl --request POST \
--url https://api.opal.dev/v1/agent-activity \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"hook_event_name": "<string>",
"tool_input": {},
"session_id": "<string>",
"prompt_id": "<string>",
"turn_id": "<string>",
"model": "<string>",
"cursor_version": "<string>",
"delivered_late": true,
"agent_id": "<string>",
"agent_type": "<string>",
"spawned_agent_id": "<unknown>",
"permission_mode": "<string>",
"actor_email": "<string>",
"opal_reported": {
"configured_email": "<string>",
"claude_account_email": "<string>",
"codex_account_email": "<string>",
"codex_auth_mode": "<string>",
"chatgpt_account_email": "<string>",
"cursor_account_email": "<string>",
"client": "<string>",
"git_email": "<string>",
"os_user": "<string>",
"hostname": "<string>"
},
"duration_ms": "<unknown>",
"transcript_path": "<string>",
"tool_name": "<string>",
"mcp_server": {
"name": "<string>",
"source": "<string>"
},
"opal_mcp_server": {
"url": "<string>",
"transport": "<string>",
"command_hash": "<string>",
"scope": "<string>"
},
"tool_use_id": "<string>",
"opal_event_id": "<string>",
"cwd": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"prompt": "<unknown>",
"tool_response": "<unknown>",
"last_assistant_message": "<unknown>",
"opal_content": {
"assistant_text": "<string>",
"thinking": "<string>",
"images": {
"count": 123,
"bytes": 123
},
"truncated": {}
},
"opal_prompt_check": {
"outcome": "<string>",
"kinds": [
"<string>"
]
}
}
]
}
'import requests
url = "https://api.opal.dev/v1/agent-activity"
payload = { "events": [
{
"hook_event_name": "<string>",
"tool_input": {},
"session_id": "<string>",
"prompt_id": "<string>",
"turn_id": "<string>",
"model": "<string>",
"cursor_version": "<string>",
"delivered_late": True,
"agent_id": "<string>",
"agent_type": "<string>",
"spawned_agent_id": "<unknown>",
"permission_mode": "<string>",
"actor_email": "<string>",
"opal_reported": {
"configured_email": "<string>",
"claude_account_email": "<string>",
"codex_account_email": "<string>",
"codex_auth_mode": "<string>",
"chatgpt_account_email": "<string>",
"cursor_account_email": "<string>",
"client": "<string>",
"git_email": "<string>",
"os_user": "<string>",
"hostname": "<string>"
},
"duration_ms": "<unknown>",
"transcript_path": "<string>",
"tool_name": "<string>",
"mcp_server": {
"name": "<string>",
"source": "<string>"
},
"opal_mcp_server": {
"url": "<string>",
"transport": "<string>",
"command_hash": "<string>",
"scope": "<string>"
},
"tool_use_id": "<string>",
"opal_event_id": "<string>",
"cwd": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"prompt": "<unknown>",
"tool_response": "<unknown>",
"last_assistant_message": "<unknown>",
"opal_content": {
"assistant_text": "<string>",
"thinking": "<string>",
"images": {
"count": 123,
"bytes": 123
},
"truncated": {}
},
"opal_prompt_check": {
"outcome": "<string>",
"kinds": ["<string>"]
}
}
] }
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({
events: [
{
hook_event_name: '<string>',
tool_input: {},
session_id: '<string>',
prompt_id: '<string>',
turn_id: '<string>',
model: '<string>',
cursor_version: '<string>',
delivered_late: true,
agent_id: '<string>',
agent_type: '<string>',
spawned_agent_id: '<unknown>',
permission_mode: '<string>',
actor_email: '<string>',
opal_reported: {
configured_email: '<string>',
claude_account_email: '<string>',
codex_account_email: '<string>',
codex_auth_mode: '<string>',
chatgpt_account_email: '<string>',
cursor_account_email: '<string>',
client: '<string>',
git_email: '<string>',
os_user: '<string>',
hostname: '<string>'
},
duration_ms: '<unknown>',
transcript_path: '<string>',
tool_name: '<string>',
mcp_server: {name: '<string>', source: '<string>'},
opal_mcp_server: {
url: '<string>',
transport: '<string>',
command_hash: '<string>',
scope: '<string>'
},
tool_use_id: '<string>',
opal_event_id: '<string>',
cwd: '<string>',
timestamp: '2023-11-07T05:31:56Z',
prompt: '<unknown>',
tool_response: '<unknown>',
last_assistant_message: '<unknown>',
opal_content: {
assistant_text: '<string>',
thinking: '<string>',
images: {count: 123, bytes: 123},
truncated: {}
},
opal_prompt_check: {outcome: '<string>', kinds: ['<string>']}
}
]
})
};
fetch('https://api.opal.dev/v1/agent-activity', 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.opal.dev/v1/agent-activity",
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' => [
[
'hook_event_name' => '<string>',
'tool_input' => [
],
'session_id' => '<string>',
'prompt_id' => '<string>',
'turn_id' => '<string>',
'model' => '<string>',
'cursor_version' => '<string>',
'delivered_late' => true,
'agent_id' => '<string>',
'agent_type' => '<string>',
'spawned_agent_id' => '<unknown>',
'permission_mode' => '<string>',
'actor_email' => '<string>',
'opal_reported' => [
'configured_email' => '<string>',
'claude_account_email' => '<string>',
'codex_account_email' => '<string>',
'codex_auth_mode' => '<string>',
'chatgpt_account_email' => '<string>',
'cursor_account_email' => '<string>',
'client' => '<string>',
'git_email' => '<string>',
'os_user' => '<string>',
'hostname' => '<string>'
],
'duration_ms' => '<unknown>',
'transcript_path' => '<string>',
'tool_name' => '<string>',
'mcp_server' => [
'name' => '<string>',
'source' => '<string>'
],
'opal_mcp_server' => [
'url' => '<string>',
'transport' => '<string>',
'command_hash' => '<string>',
'scope' => '<string>'
],
'tool_use_id' => '<string>',
'opal_event_id' => '<string>',
'cwd' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'prompt' => '<unknown>',
'tool_response' => '<unknown>',
'last_assistant_message' => '<unknown>',
'opal_content' => [
'assistant_text' => '<string>',
'thinking' => '<string>',
'images' => [
'count' => 123,
'bytes' => 123
],
'truncated' => [
]
],
'opal_prompt_check' => [
'outcome' => '<string>',
'kinds' => [
'<string>'
]
]
]
]
]),
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.opal.dev/v1/agent-activity"
payload := strings.NewReader("{\n \"events\": [\n {\n \"hook_event_name\": \"<string>\",\n \"tool_input\": {},\n \"session_id\": \"<string>\",\n \"prompt_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"model\": \"<string>\",\n \"cursor_version\": \"<string>\",\n \"delivered_late\": true,\n \"agent_id\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"spawned_agent_id\": \"<unknown>\",\n \"permission_mode\": \"<string>\",\n \"actor_email\": \"<string>\",\n \"opal_reported\": {\n \"configured_email\": \"<string>\",\n \"claude_account_email\": \"<string>\",\n \"codex_account_email\": \"<string>\",\n \"codex_auth_mode\": \"<string>\",\n \"chatgpt_account_email\": \"<string>\",\n \"cursor_account_email\": \"<string>\",\n \"client\": \"<string>\",\n \"git_email\": \"<string>\",\n \"os_user\": \"<string>\",\n \"hostname\": \"<string>\"\n },\n \"duration_ms\": \"<unknown>\",\n \"transcript_path\": \"<string>\",\n \"tool_name\": \"<string>\",\n \"mcp_server\": {\n \"name\": \"<string>\",\n \"source\": \"<string>\"\n },\n \"opal_mcp_server\": {\n \"url\": \"<string>\",\n \"transport\": \"<string>\",\n \"command_hash\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"tool_use_id\": \"<string>\",\n \"opal_event_id\": \"<string>\",\n \"cwd\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"prompt\": \"<unknown>\",\n \"tool_response\": \"<unknown>\",\n \"last_assistant_message\": \"<unknown>\",\n \"opal_content\": {\n \"assistant_text\": \"<string>\",\n \"thinking\": \"<string>\",\n \"images\": {\n \"count\": 123,\n \"bytes\": 123\n },\n \"truncated\": {}\n },\n \"opal_prompt_check\": {\n \"outcome\": \"<string>\",\n \"kinds\": [\n \"<string>\"\n ]\n }\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.opal.dev/v1/agent-activity")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"hook_event_name\": \"<string>\",\n \"tool_input\": {},\n \"session_id\": \"<string>\",\n \"prompt_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"model\": \"<string>\",\n \"cursor_version\": \"<string>\",\n \"delivered_late\": true,\n \"agent_id\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"spawned_agent_id\": \"<unknown>\",\n \"permission_mode\": \"<string>\",\n \"actor_email\": \"<string>\",\n \"opal_reported\": {\n \"configured_email\": \"<string>\",\n \"claude_account_email\": \"<string>\",\n \"codex_account_email\": \"<string>\",\n \"codex_auth_mode\": \"<string>\",\n \"chatgpt_account_email\": \"<string>\",\n \"cursor_account_email\": \"<string>\",\n \"client\": \"<string>\",\n \"git_email\": \"<string>\",\n \"os_user\": \"<string>\",\n \"hostname\": \"<string>\"\n },\n \"duration_ms\": \"<unknown>\",\n \"transcript_path\": \"<string>\",\n \"tool_name\": \"<string>\",\n \"mcp_server\": {\n \"name\": \"<string>\",\n \"source\": \"<string>\"\n },\n \"opal_mcp_server\": {\n \"url\": \"<string>\",\n \"transport\": \"<string>\",\n \"command_hash\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"tool_use_id\": \"<string>\",\n \"opal_event_id\": \"<string>\",\n \"cwd\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"prompt\": \"<unknown>\",\n \"tool_response\": \"<unknown>\",\n \"last_assistant_message\": \"<unknown>\",\n \"opal_content\": {\n \"assistant_text\": \"<string>\",\n \"thinking\": \"<string>\",\n \"images\": {\n \"count\": 123,\n \"bytes\": 123\n },\n \"truncated\": {}\n },\n \"opal_prompt_check\": {\n \"outcome\": \"<string>\",\n \"kinds\": [\n \"<string>\"\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/agent-activity")
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 \"events\": [\n {\n \"hook_event_name\": \"<string>\",\n \"tool_input\": {},\n \"session_id\": \"<string>\",\n \"prompt_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"model\": \"<string>\",\n \"cursor_version\": \"<string>\",\n \"delivered_late\": true,\n \"agent_id\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"spawned_agent_id\": \"<unknown>\",\n \"permission_mode\": \"<string>\",\n \"actor_email\": \"<string>\",\n \"opal_reported\": {\n \"configured_email\": \"<string>\",\n \"claude_account_email\": \"<string>\",\n \"codex_account_email\": \"<string>\",\n \"codex_auth_mode\": \"<string>\",\n \"chatgpt_account_email\": \"<string>\",\n \"cursor_account_email\": \"<string>\",\n \"client\": \"<string>\",\n \"git_email\": \"<string>\",\n \"os_user\": \"<string>\",\n \"hostname\": \"<string>\"\n },\n \"duration_ms\": \"<unknown>\",\n \"transcript_path\": \"<string>\",\n \"tool_name\": \"<string>\",\n \"mcp_server\": {\n \"name\": \"<string>\",\n \"source\": \"<string>\"\n },\n \"opal_mcp_server\": {\n \"url\": \"<string>\",\n \"transport\": \"<string>\",\n \"command_hash\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"tool_use_id\": \"<string>\",\n \"opal_event_id\": \"<string>\",\n \"cwd\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"prompt\": \"<unknown>\",\n \"tool_response\": \"<unknown>\",\n \"last_assistant_message\": \"<unknown>\",\n \"opal_content\": {\n \"assistant_text\": \"<string>\",\n \"thinking\": \"<string>\",\n \"images\": {\n \"count\": 123,\n \"bytes\": 123\n },\n \"truncated\": {}\n },\n \"opal_prompt_check\": {\n \"outcome\": \"<string>\",\n \"kinds\": [\n \"<string>\"\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"received": 123,
"stored": 123,
"attributed": 123,
"unattributed": 123
}Report agent activity
Reports activity observed by an agent runtime on a developer’s machine: Claude Code, Codex and Cursor hook events, or the same events from any other harness.
A custom harness sends each event in Claude Code’s hook shape (AgentActivityEvent): opal_reported.client with the harness’s name, hook_event_name, and for a tool call tool_name, tool_input and tool_use_id, with session_id and prompt_id to group calls into sessions and turns. It authenticates with either the organization’s agent hooks key plus an X-Opal-Actor header, which records the person but no agent, or the key of a service user linked to an agent Opal did not import from Anthropic, which puts the events on that agent. At ingest, a custom harness’s events never land on a Claude agent or on a person’s own agent. An event stored with no agent can still be attributed later to a Claude agent, when Claude Code’s OpenTelemetry export reports the same session_id.
Only a single raw PreToolUse payload that is not marked delivered_late can be answered with a decision. When the kill switch, a pause or a policy rule stops the call, the answer is Claude Code’s hook output, still with a 200: {"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "deny", "permissionDecisionReason": "..."}}. Otherwise the body is empty. A rule other than a pause stops a call only while the organization enforces rules and the client’s Enforce switch is on; otherwise its verdict is only recorded. A pause and the kill switch stop a call whatever the Enforce switch says, though a pause only while the organization has agent activity insights turned on. A client whose Log and Enforce switches are both off gets none of this: Opal checks, stops and stores nothing it sends, and answers with a 200 that lets the call run. A rule that needs approval answers ask to Claude Code and deny to every other runtime. A harness that blocks some other way translates the answer itself. Every check fails open: policy rules get 1.5 seconds and a rule that times out or fails lets the call through, but the whole request can take a few seconds more (Opal’s own hook waits 5 seconds), and an error in another check is a 500. So a sender should run the call when Opal times out, cannot be reached or answers with anything but a 2xx. A batch, a late copy and a prompt are stored but never answered.
This is telemetry from cooperating machines, not attestation. Opal can only see what a configured, consenting client chooses to send, cannot verify that a fleet is configured at all, and has no way to detect a machine that is reporting nothing. Absence of activity for an agent therefore means “nothing was reported”, never “the agent did nothing”.
The request body is either a batch envelope ({"events": [...]}), a bare JSON array of events, or a single raw hook payload - the last so a hook can POST here directly with no relay in between.
The bearer token establishes the organization, and some keys also name the agent: a service user’s key the agent the service user is linked to, and a person’s own hooks sign-in token that person and their own agent (for a custom harness, only the person). No field in the payload is treated as an identity claim Opal trusts: the actor headers below are used for best-effort attribution and display only. Events that cannot be attributed to an agent are retained and surfaced as unattributed activity rather than dropped.
curl --request POST \
--url https://api.opal.dev/v1/agent-activity \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"hook_event_name": "<string>",
"tool_input": {},
"session_id": "<string>",
"prompt_id": "<string>",
"turn_id": "<string>",
"model": "<string>",
"cursor_version": "<string>",
"delivered_late": true,
"agent_id": "<string>",
"agent_type": "<string>",
"spawned_agent_id": "<unknown>",
"permission_mode": "<string>",
"actor_email": "<string>",
"opal_reported": {
"configured_email": "<string>",
"claude_account_email": "<string>",
"codex_account_email": "<string>",
"codex_auth_mode": "<string>",
"chatgpt_account_email": "<string>",
"cursor_account_email": "<string>",
"client": "<string>",
"git_email": "<string>",
"os_user": "<string>",
"hostname": "<string>"
},
"duration_ms": "<unknown>",
"transcript_path": "<string>",
"tool_name": "<string>",
"mcp_server": {
"name": "<string>",
"source": "<string>"
},
"opal_mcp_server": {
"url": "<string>",
"transport": "<string>",
"command_hash": "<string>",
"scope": "<string>"
},
"tool_use_id": "<string>",
"opal_event_id": "<string>",
"cwd": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"prompt": "<unknown>",
"tool_response": "<unknown>",
"last_assistant_message": "<unknown>",
"opal_content": {
"assistant_text": "<string>",
"thinking": "<string>",
"images": {
"count": 123,
"bytes": 123
},
"truncated": {}
},
"opal_prompt_check": {
"outcome": "<string>",
"kinds": [
"<string>"
]
}
}
]
}
'import requests
url = "https://api.opal.dev/v1/agent-activity"
payload = { "events": [
{
"hook_event_name": "<string>",
"tool_input": {},
"session_id": "<string>",
"prompt_id": "<string>",
"turn_id": "<string>",
"model": "<string>",
"cursor_version": "<string>",
"delivered_late": True,
"agent_id": "<string>",
"agent_type": "<string>",
"spawned_agent_id": "<unknown>",
"permission_mode": "<string>",
"actor_email": "<string>",
"opal_reported": {
"configured_email": "<string>",
"claude_account_email": "<string>",
"codex_account_email": "<string>",
"codex_auth_mode": "<string>",
"chatgpt_account_email": "<string>",
"cursor_account_email": "<string>",
"client": "<string>",
"git_email": "<string>",
"os_user": "<string>",
"hostname": "<string>"
},
"duration_ms": "<unknown>",
"transcript_path": "<string>",
"tool_name": "<string>",
"mcp_server": {
"name": "<string>",
"source": "<string>"
},
"opal_mcp_server": {
"url": "<string>",
"transport": "<string>",
"command_hash": "<string>",
"scope": "<string>"
},
"tool_use_id": "<string>",
"opal_event_id": "<string>",
"cwd": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"prompt": "<unknown>",
"tool_response": "<unknown>",
"last_assistant_message": "<unknown>",
"opal_content": {
"assistant_text": "<string>",
"thinking": "<string>",
"images": {
"count": 123,
"bytes": 123
},
"truncated": {}
},
"opal_prompt_check": {
"outcome": "<string>",
"kinds": ["<string>"]
}
}
] }
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({
events: [
{
hook_event_name: '<string>',
tool_input: {},
session_id: '<string>',
prompt_id: '<string>',
turn_id: '<string>',
model: '<string>',
cursor_version: '<string>',
delivered_late: true,
agent_id: '<string>',
agent_type: '<string>',
spawned_agent_id: '<unknown>',
permission_mode: '<string>',
actor_email: '<string>',
opal_reported: {
configured_email: '<string>',
claude_account_email: '<string>',
codex_account_email: '<string>',
codex_auth_mode: '<string>',
chatgpt_account_email: '<string>',
cursor_account_email: '<string>',
client: '<string>',
git_email: '<string>',
os_user: '<string>',
hostname: '<string>'
},
duration_ms: '<unknown>',
transcript_path: '<string>',
tool_name: '<string>',
mcp_server: {name: '<string>', source: '<string>'},
opal_mcp_server: {
url: '<string>',
transport: '<string>',
command_hash: '<string>',
scope: '<string>'
},
tool_use_id: '<string>',
opal_event_id: '<string>',
cwd: '<string>',
timestamp: '2023-11-07T05:31:56Z',
prompt: '<unknown>',
tool_response: '<unknown>',
last_assistant_message: '<unknown>',
opal_content: {
assistant_text: '<string>',
thinking: '<string>',
images: {count: 123, bytes: 123},
truncated: {}
},
opal_prompt_check: {outcome: '<string>', kinds: ['<string>']}
}
]
})
};
fetch('https://api.opal.dev/v1/agent-activity', 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.opal.dev/v1/agent-activity",
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' => [
[
'hook_event_name' => '<string>',
'tool_input' => [
],
'session_id' => '<string>',
'prompt_id' => '<string>',
'turn_id' => '<string>',
'model' => '<string>',
'cursor_version' => '<string>',
'delivered_late' => true,
'agent_id' => '<string>',
'agent_type' => '<string>',
'spawned_agent_id' => '<unknown>',
'permission_mode' => '<string>',
'actor_email' => '<string>',
'opal_reported' => [
'configured_email' => '<string>',
'claude_account_email' => '<string>',
'codex_account_email' => '<string>',
'codex_auth_mode' => '<string>',
'chatgpt_account_email' => '<string>',
'cursor_account_email' => '<string>',
'client' => '<string>',
'git_email' => '<string>',
'os_user' => '<string>',
'hostname' => '<string>'
],
'duration_ms' => '<unknown>',
'transcript_path' => '<string>',
'tool_name' => '<string>',
'mcp_server' => [
'name' => '<string>',
'source' => '<string>'
],
'opal_mcp_server' => [
'url' => '<string>',
'transport' => '<string>',
'command_hash' => '<string>',
'scope' => '<string>'
],
'tool_use_id' => '<string>',
'opal_event_id' => '<string>',
'cwd' => '<string>',
'timestamp' => '2023-11-07T05:31:56Z',
'prompt' => '<unknown>',
'tool_response' => '<unknown>',
'last_assistant_message' => '<unknown>',
'opal_content' => [
'assistant_text' => '<string>',
'thinking' => '<string>',
'images' => [
'count' => 123,
'bytes' => 123
],
'truncated' => [
]
],
'opal_prompt_check' => [
'outcome' => '<string>',
'kinds' => [
'<string>'
]
]
]
]
]),
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.opal.dev/v1/agent-activity"
payload := strings.NewReader("{\n \"events\": [\n {\n \"hook_event_name\": \"<string>\",\n \"tool_input\": {},\n \"session_id\": \"<string>\",\n \"prompt_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"model\": \"<string>\",\n \"cursor_version\": \"<string>\",\n \"delivered_late\": true,\n \"agent_id\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"spawned_agent_id\": \"<unknown>\",\n \"permission_mode\": \"<string>\",\n \"actor_email\": \"<string>\",\n \"opal_reported\": {\n \"configured_email\": \"<string>\",\n \"claude_account_email\": \"<string>\",\n \"codex_account_email\": \"<string>\",\n \"codex_auth_mode\": \"<string>\",\n \"chatgpt_account_email\": \"<string>\",\n \"cursor_account_email\": \"<string>\",\n \"client\": \"<string>\",\n \"git_email\": \"<string>\",\n \"os_user\": \"<string>\",\n \"hostname\": \"<string>\"\n },\n \"duration_ms\": \"<unknown>\",\n \"transcript_path\": \"<string>\",\n \"tool_name\": \"<string>\",\n \"mcp_server\": {\n \"name\": \"<string>\",\n \"source\": \"<string>\"\n },\n \"opal_mcp_server\": {\n \"url\": \"<string>\",\n \"transport\": \"<string>\",\n \"command_hash\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"tool_use_id\": \"<string>\",\n \"opal_event_id\": \"<string>\",\n \"cwd\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"prompt\": \"<unknown>\",\n \"tool_response\": \"<unknown>\",\n \"last_assistant_message\": \"<unknown>\",\n \"opal_content\": {\n \"assistant_text\": \"<string>\",\n \"thinking\": \"<string>\",\n \"images\": {\n \"count\": 123,\n \"bytes\": 123\n },\n \"truncated\": {}\n },\n \"opal_prompt_check\": {\n \"outcome\": \"<string>\",\n \"kinds\": [\n \"<string>\"\n ]\n }\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.opal.dev/v1/agent-activity")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"hook_event_name\": \"<string>\",\n \"tool_input\": {},\n \"session_id\": \"<string>\",\n \"prompt_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"model\": \"<string>\",\n \"cursor_version\": \"<string>\",\n \"delivered_late\": true,\n \"agent_id\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"spawned_agent_id\": \"<unknown>\",\n \"permission_mode\": \"<string>\",\n \"actor_email\": \"<string>\",\n \"opal_reported\": {\n \"configured_email\": \"<string>\",\n \"claude_account_email\": \"<string>\",\n \"codex_account_email\": \"<string>\",\n \"codex_auth_mode\": \"<string>\",\n \"chatgpt_account_email\": \"<string>\",\n \"cursor_account_email\": \"<string>\",\n \"client\": \"<string>\",\n \"git_email\": \"<string>\",\n \"os_user\": \"<string>\",\n \"hostname\": \"<string>\"\n },\n \"duration_ms\": \"<unknown>\",\n \"transcript_path\": \"<string>\",\n \"tool_name\": \"<string>\",\n \"mcp_server\": {\n \"name\": \"<string>\",\n \"source\": \"<string>\"\n },\n \"opal_mcp_server\": {\n \"url\": \"<string>\",\n \"transport\": \"<string>\",\n \"command_hash\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"tool_use_id\": \"<string>\",\n \"opal_event_id\": \"<string>\",\n \"cwd\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"prompt\": \"<unknown>\",\n \"tool_response\": \"<unknown>\",\n \"last_assistant_message\": \"<unknown>\",\n \"opal_content\": {\n \"assistant_text\": \"<string>\",\n \"thinking\": \"<string>\",\n \"images\": {\n \"count\": 123,\n \"bytes\": 123\n },\n \"truncated\": {}\n },\n \"opal_prompt_check\": {\n \"outcome\": \"<string>\",\n \"kinds\": [\n \"<string>\"\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.opal.dev/v1/agent-activity")
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 \"events\": [\n {\n \"hook_event_name\": \"<string>\",\n \"tool_input\": {},\n \"session_id\": \"<string>\",\n \"prompt_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"model\": \"<string>\",\n \"cursor_version\": \"<string>\",\n \"delivered_late\": true,\n \"agent_id\": \"<string>\",\n \"agent_type\": \"<string>\",\n \"spawned_agent_id\": \"<unknown>\",\n \"permission_mode\": \"<string>\",\n \"actor_email\": \"<string>\",\n \"opal_reported\": {\n \"configured_email\": \"<string>\",\n \"claude_account_email\": \"<string>\",\n \"codex_account_email\": \"<string>\",\n \"codex_auth_mode\": \"<string>\",\n \"chatgpt_account_email\": \"<string>\",\n \"cursor_account_email\": \"<string>\",\n \"client\": \"<string>\",\n \"git_email\": \"<string>\",\n \"os_user\": \"<string>\",\n \"hostname\": \"<string>\"\n },\n \"duration_ms\": \"<unknown>\",\n \"transcript_path\": \"<string>\",\n \"tool_name\": \"<string>\",\n \"mcp_server\": {\n \"name\": \"<string>\",\n \"source\": \"<string>\"\n },\n \"opal_mcp_server\": {\n \"url\": \"<string>\",\n \"transport\": \"<string>\",\n \"command_hash\": \"<string>\",\n \"scope\": \"<string>\"\n },\n \"tool_use_id\": \"<string>\",\n \"opal_event_id\": \"<string>\",\n \"cwd\": \"<string>\",\n \"timestamp\": \"2023-11-07T05:31:56Z\",\n \"prompt\": \"<unknown>\",\n \"tool_response\": \"<unknown>\",\n \"last_assistant_message\": \"<unknown>\",\n \"opal_content\": {\n \"assistant_text\": \"<string>\",\n \"thinking\": \"<string>\",\n \"images\": {\n \"count\": 123,\n \"bytes\": 123\n },\n \"truncated\": {}\n },\n \"opal_prompt_check\": {\n \"outcome\": \"<string>\",\n \"kinds\": [\n \"<string>\"\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"received": 123,
"stored": 123,
"attributed": 123,
"unattributed": 123
}Authorizations
Headers
The identity the reporting client claims this activity belongs to - an email or an Anthropic user id. Unverified: a Claude Code hook payload contains no user identity, so this has to be injected by whoever deploys the hook (via the http handler's headers map and allowedEnvVars interpolation), and whoever controls the machine controls the header. Used only when the API key itself does not identify a developer. When the email belongs to a person in the organization, that person is recorded as who the activity was reported for (always as a claim). A Claude Code or Cowork event is also attributed to the one Claude agent they own, if they own exactly one, and a Codex, ChatGPT or Cursor event to their agent for that runtime. An event from any other client, a custom harness included, records the person but none of their agents. The API key's own email is never treated this way: a key belongs to whoever created it, which with a shared key is not who is at the keyboard. Omitting it is valid. When an event's opal_reported object carries other emails, Opal also tries them, in the order cursor_account_email, configured_email, claude_account_email, codex_account_email, chatgpt_account_email, git_email, after this header and skipping any that repeat it. The first one that resolves to an agent wins.
The name of the machine that sent this request, as that machine reports it (hostname -s). Unverified: two machines can share a name, and whoever controls the machine controls the header. Stored with each event, so a reader can tell which machine reported it. When an event's own opal_reported.hostname names a different machine, this header wins and the body's value is kept beside it. Omitting it is valid.
1 when the sender collects conversation content: the prompt of a UserPromptSubmit event, the tool_response of a PostToolUse event and the last_assistant_message of a Stop or SubagentStop event. Without it (or an event's own opal_content) those fields are read and discarded, as before. An http hook sets it in its headers map, because it cannot change the payload. Opal stores the content only when the organization stores content as well, the client's conversation content setting is not Never and its Log switch is on. When Opal cannot read the client settings it stores no content.
Body
AgentActivityIngestRequest Object
Description
A batch of agent activity events.
Three body shapes are accepted: this envelope ({"events": [...]}), a bare JSON
array of AgentActivityEvent, and a single AgentActivityEvent object. The last
exists so a Claude Code hook can POST here directly, since a hook sends one bare
payload per event and cannot wrap it.
Response
For a batch, a per-batch accounting of what was accepted, stored, and attributed. A single raw payload gets an empty body, or the hook output described above. A 200 does not mean the events were stored. An organization that has agent activity turned off (a retention of 0 days) gets a 200 with an empty body for every body shape, so a sender does not keep the events and try again. A client whose Log and Enforce switches are both off also gets a 200, and nothing it sends is checked, stopped or stored. A client with only Enforce on gets a 200 too, and only a checked PreToolUse that a rule, a pause or the kill switch flagged, held or blocked (including a verdict Opal only recorded) and a prompt the kit flagged are stored; a batch's other events are dropped and not counted in received. A batch's stored count is the way to check a new setup.
AgentActivityIngestResult Object
Description
What one ingest request actually did.
received and stored differ when a delivery was retried and deduplicated.
attributed and unattributed sum to received rather than to stored, because
attribution happens before deduplication. Unattributed events are kept, not dropped:
activity Opal cannot tie to a governed agent is itself a governance finding.
Was this page helpful?