Log
Go SDK
v0.1.10 cannot create an audit entry through
client.Audit.Log: its LogAuditParams omits the API-required agentDid and
principalId fields. Use the REST endpoint or CLI for writes.
List and get remain available, but AuditEntry omits DeveloperID; the SDK
advertises Since, Until, Page, and PageSize filters that the API ignores;
and list helpers do not URL-encode reserved characters in filter values. Use only
AgentID, GrantID, PrincipalID, and Action, and issue a URL-encoded REST
request when the missing field or reserved characters matter.
Repository source on main corrects these gaps with regression coverage, but no
corrected Go module tag has been published. This warning still applies to v0.1.10.REST workaround
curl -X POST https://api.grantex.dev/v1/audit/log \
-H "Authorization: Bearer $GRANTEX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agentId": "ag_01HXYZ...",
"agentDid": "did:grantex:ag_01HXYZ...",
"grantId": "grnt_01HXYZ...",
"principalId": "user_123",
"action": "email:read",
"status": "success",
"metadata": {"messageId": "msg-123"}
}'
List
result, err := client.Audit.List(ctx, &grantex.ListAuditParams{
AgentID: "agent-id",
PrincipalID: "user-123",
Action: "email:read",
})
for _, e := range result.Entries {
fmt.Printf("[%s] %s: %s\n", e.Timestamp, e.Action, e.Status)
}
nil for no filters.
Get
entry, err := client.Audit.Get(ctx, "entry-id")
Types
AuditEntry
This table describes repository source on
main. Public v0.1.10 omits
DeveloperID; use the REST response when that field is required.| Field | Type | Description |
|---|---|---|
EntryID | string | Entry ID |
AgentID | string | Agent ID |
AgentDID | string | Agent DID |
GrantID | string | Grant ID |
PrincipalID | string | User ID |
DeveloperID | string | Owner developer ID (repository source on main; absent from public v0.1.10) |
Action | string | Action performed |
Metadata | map[string]interface{} | Custom metadata |
Hash | string | Entry hash (chain integrity) |
PrevHash | *string | Previous entry hash |
Timestamp | string | ISO 8601 timestamp |
Status | string | "success", "failure", "blocked" |