curl --request POST \
--url https://api.assembly.com/v1/events \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"context": {},
"eventDescription": "Client viewed the dashboard",
"eventType": "customEvent",
"actorId": "a1b2c3d4-e5f6-4711-8899-aabbccddeeff",
"companyId": "c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa",
"lastActivityAt": "2024-02-20T14:05:00Z"
}
'import requests
url = "https://api.assembly.com/v1/events"
payload = {
"context": {},
"eventDescription": "Client viewed the dashboard",
"eventType": "customEvent",
"actorId": "a1b2c3d4-e5f6-4711-8899-aabbccddeeff",
"companyId": "c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa",
"lastActivityAt": "2024-02-20T14:05: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({
context: {},
eventDescription: 'Client viewed the dashboard',
eventType: 'customEvent',
actorId: 'a1b2c3d4-e5f6-4711-8899-aabbccddeeff',
companyId: 'c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa',
lastActivityAt: '2024-02-20T14:05:00Z'
})
};
fetch('https://api.assembly.com/v1/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 => "https://api.assembly.com/v1/events",
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([
'context' => [
],
'eventDescription' => 'Client viewed the dashboard',
'eventType' => 'customEvent',
'actorId' => 'a1b2c3d4-e5f6-4711-8899-aabbccddeeff',
'companyId' => 'c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa',
'lastActivityAt' => '2024-02-20T14:05: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.assembly.com/v1/events"
payload := strings.NewReader("{\n \"context\": {},\n \"eventDescription\": \"Client viewed the dashboard\",\n \"eventType\": \"customEvent\",\n \"actorId\": \"a1b2c3d4-e5f6-4711-8899-aabbccddeeff\",\n \"companyId\": \"c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa\",\n \"lastActivityAt\": \"2024-02-20T14:05:00Z\"\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.assembly.com/v1/events")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"context\": {},\n \"eventDescription\": \"Client viewed the dashboard\",\n \"eventType\": \"customEvent\",\n \"actorId\": \"a1b2c3d4-e5f6-4711-8899-aabbccddeeff\",\n \"companyId\": \"c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa\",\n \"lastActivityAt\": \"2024-02-20T14:05:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assembly.com/v1/events")
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 \"context\": {},\n \"eventDescription\": \"Client viewed the dashboard\",\n \"eventType\": \"customEvent\",\n \"actorId\": \"a1b2c3d4-e5f6-4711-8899-aabbccddeeff\",\n \"companyId\": \"c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa\",\n \"lastActivityAt\": \"2024-02-20T14:05:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"actorId": "a1b2c3d4-e5f6-4711-8899-aabbccddeeff",
"actorRole": "admin",
"actorType": "internalUser",
"apiKeyRef": "key_01HZX8K9P2",
"automationId": "auto_01HZX8K9P2",
"companyId": "c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa",
"context": {},
"createdAt": "<string>",
"creatorId": "<string>",
"data": "<string>",
"eventDescription": "Client created",
"eventDetails": "Updated billing address",
"eventTextEntity": "Acme Corp",
"eventTextPrefix": "Client",
"eventType": "clientCreated",
"id": "<string>",
"identityId": "<string>",
"ip": "203.0.113.42",
"isSuperAdminTriggered": false,
"object": "<string>",
"previousAttributes": {},
"ref": "<string>",
"source": "web",
"updatedAt": "<string>",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}Create an audit event
Records a custom audit log event for the authenticated workspace. Platform-API callers must be on an enterprise plan.
curl --request POST \
--url https://api.assembly.com/v1/events \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"context": {},
"eventDescription": "Client viewed the dashboard",
"eventType": "customEvent",
"actorId": "a1b2c3d4-e5f6-4711-8899-aabbccddeeff",
"companyId": "c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa",
"lastActivityAt": "2024-02-20T14:05:00Z"
}
'import requests
url = "https://api.assembly.com/v1/events"
payload = {
"context": {},
"eventDescription": "Client viewed the dashboard",
"eventType": "customEvent",
"actorId": "a1b2c3d4-e5f6-4711-8899-aabbccddeeff",
"companyId": "c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa",
"lastActivityAt": "2024-02-20T14:05: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({
context: {},
eventDescription: 'Client viewed the dashboard',
eventType: 'customEvent',
actorId: 'a1b2c3d4-e5f6-4711-8899-aabbccddeeff',
companyId: 'c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa',
lastActivityAt: '2024-02-20T14:05:00Z'
})
};
fetch('https://api.assembly.com/v1/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 => "https://api.assembly.com/v1/events",
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([
'context' => [
],
'eventDescription' => 'Client viewed the dashboard',
'eventType' => 'customEvent',
'actorId' => 'a1b2c3d4-e5f6-4711-8899-aabbccddeeff',
'companyId' => 'c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa',
'lastActivityAt' => '2024-02-20T14:05: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.assembly.com/v1/events"
payload := strings.NewReader("{\n \"context\": {},\n \"eventDescription\": \"Client viewed the dashboard\",\n \"eventType\": \"customEvent\",\n \"actorId\": \"a1b2c3d4-e5f6-4711-8899-aabbccddeeff\",\n \"companyId\": \"c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa\",\n \"lastActivityAt\": \"2024-02-20T14:05:00Z\"\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.assembly.com/v1/events")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"context\": {},\n \"eventDescription\": \"Client viewed the dashboard\",\n \"eventType\": \"customEvent\",\n \"actorId\": \"a1b2c3d4-e5f6-4711-8899-aabbccddeeff\",\n \"companyId\": \"c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa\",\n \"lastActivityAt\": \"2024-02-20T14:05:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assembly.com/v1/events")
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 \"context\": {},\n \"eventDescription\": \"Client viewed the dashboard\",\n \"eventType\": \"customEvent\",\n \"actorId\": \"a1b2c3d4-e5f6-4711-8899-aabbccddeeff\",\n \"companyId\": \"c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa\",\n \"lastActivityAt\": \"2024-02-20T14:05:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"actorId": "a1b2c3d4-e5f6-4711-8899-aabbccddeeff",
"actorRole": "admin",
"actorType": "internalUser",
"apiKeyRef": "key_01HZX8K9P2",
"automationId": "auto_01HZX8K9P2",
"companyId": "c1d2e3f4-a5b6-4712-9988-ffeeddccbbaa",
"context": {},
"createdAt": "<string>",
"creatorId": "<string>",
"data": "<string>",
"eventDescription": "Client created",
"eventDetails": "Updated billing address",
"eventTextEntity": "Acme Corp",
"eventTextPrefix": "Client",
"eventType": "clientCreated",
"id": "<string>",
"identityId": "<string>",
"ip": "203.0.113.42",
"isSuperAdminTriggered": false,
"object": "<string>",
"previousAttributes": {},
"ref": "<string>",
"source": "web",
"updatedAt": "<string>",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}{
"code": "<string>",
"data": "<unknown>",
"message": "<string>"
}Body
Audit event to create
LastActivityAt is the frontend's latest evidence of user activity for the session this event pertains to. On sessionEnded it stamps the entry's CreatedAt so the inactivity timer reports the actual moment the user became idle; on sessionStarted it carries the prior session's last-activity forward so the orphan backfill can stamp the synthetic sessionEnded accurately.
"2024-02-20T14:05:00Z"
Response
Created
EventTextPrefix / EventTextEntity / EventDetails are computed at read time by FormatEvent (see event_formatter.go) and exposed to the internal audit log page and the CSV export so both render identical text. Not persisted, and tagged omitexternal — these are UI helpers, not part of the public platform API contract.
Prefix and Entity intentionally omit omitempty: FormatEvent sets one
of them to "" on purpose for events like messageSent (entity is the
linked label, no prefix). With omitempty the empty string would drop
from the wire, the client would ?? back to eventDescription, and the
row would render as Message sent "Message sent" instead of a single
linked Message sent.
"Client"
EventType categorizes the event.
userLoggedIn, userLoggedOut, userLoginSucceeded, userLoginFailed, passwordReset, passwordChanged, googleDelinked, magicLinkSent, workspaceMfaEnabled, workspaceMfaDisabled, clientCreated, clientActivated, clientUpdated, clientDeleted, clientInvited, clientArchived, clientRestored, companyCreated, companyUpdated, companyCustomFieldsUpdated, companyDeleted, clientCustomFieldsUpdated, customFieldUpdated, customFieldDeleted, fileCreated, fileUpdated, fileDeleted, folderCreated, folderUpdated, folderDeleted, linkCreated, linkUpdated, linkDeleted, invoiceCreated, invoiceInitiated, invoicePaid, invoiceUpdated, invoiceDeleted, invoiceVoided, invoiceDownloaded, refundRequested, refundSucceeded, refundFailed, messageSent, messageChannelCreated, messageChannelDeleted, taskCreated, taskUpdated, taskDeleted, taskArchived, taskCompleted, paymentSucceeded, paymentFailed, subscriptionCreated, subscriptionCancelled, priceCreated, productCreated, productUpdated, contractRequested, contractCompleted, contractDownloaded, fileDownloaded, fileBatchDownloaded, fileBatchDeleted, noteCreated, noteUpdated, noteDeleted, internalUserCreated, internalUserDeleted, internalUserAccessLevelChanged, internalUserClientVisibilitySet, assistantAccessUpdated, apiKeyCreated, apiKeyDeleted, connectorConnected, connectorReconnected, connectorRevoked, connectorRevokedExternally, siteCredentialCreated, siteCredentialUsed, siteCredentialDeleted, formCreated, formEdited, formAssigned, formResponseCompleted, customEvent, sessionStarted, sessionEnded, appApiResourceRegistered, appApiResourceUpdated, appApiResourceDeleted, appAccessCreated, appAccessStatusChanged, appAccessDeleted, appBuilderSecretUpdated, appEventEmitted, appDataChanged, clientCallRiskAccepted, qaAgentBearerMinted, qaImpersonationTokenMinted, qaPrincipalCreated, qaPrincipalDeleted "clientCreated"
UserAgent is the User-Agent header of the request that triggered the event. UserAgent and IP are intentionally exposed to external consumers (no omitexternal tag). These fields contain PII; consumers are responsible for GDPR/CCPA compliance
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7)"