useCapxulOrganizationAuditLog
Query hook for an organization's audit log — administrative actions recorded against the org, scoped by org id.
Reads an organization's audit log — a list of administrative actions
recorded against the org, each with an action name, actor, and human-readable
summary. It sits alongside the other org-scoped reads such as
useCapxulOrgMembers.
In the published alpha the underlying client method is not implemented: every
fetch fails with a not-implemented CapxulError.
The hook and its types are published so you can wire the surface today, but do
not ship a screen that depends on this data yet. See
Capability status.
Import
import { useCapxulOrganizationAuditLog } from "@capxul/sdk-react";Usage
"use client";
import type { OrgId } from "@capxul/sdk";
import { useCapxulOrganizationAuditLog } from "@capxul/sdk-react";
function AuditLog({ orgId }: { orgId: OrgId }) {
const auditLog = useCapxulOrganizationAuditLog(orgId);
if (auditLog.isLoading) return <p>Loading audit log…</p>;
if (auditLog.error) return <p>{auditLog.error.message}</p>;
return (
<ul>
{auditLog.data.map((item) => (
<li key={item.id}>
{item.summary} {item.actor ? `— ${item.actor}` : null}
</li>
))}
</ul>
);
}Parameters
organizationId
OrgId | undefined
The organization whose audit log to read. The query stays disabled while
organizationId is undefined, so you can pass the result of another query
directly — no manual gating needed.
options
UseCapxulOrganizationAuditLogOptions | undefined
Prop
Type
Return type
import { type UseCapxulOrganizationAuditLogReturn } from "@capxul/sdk-react";
// UseQueryResult<readonly OrganizationAuditLogItem[], CapxulError>data is a list of OrganizationAuditLogItem records:
| Field | Type | Description |
|---|---|---|
id | string | The log entry's id. |
organizationId | string | The org the action was recorded against. |
action | string | Machine-readable action name. |
actor | string | null | Who performed the action, when known. |
summary | string | Human-readable description of the action. |
createdAt | number | Numeric timestamp of when the action was recorded. |
metadata | Record<string, unknown> | undefined | Optional structured detail. |
The hook returns TanStack Query's UseQueryResult. The most-used fields:
| Field | Description |
|---|---|
data | The query data (typed per hook, shown above). undefined until the first success. |
error | A CapxulError when the last fetch failed, otherwise null. |
status | 'pending' | 'error' | 'success'. |
isLoading | true during the first fetch (no data yet). |
isFetching | true whenever a fetch is in flight, including background refetches. |
refetch | Manually refetch the query. |
Capxul query hooks stay pending until the provider finishes bootstrapping —
you do not need to gate them on useCapxul() yourself. The full field list is
in the TanStack Query useQuery reference;
see also the TanStack Query integration guide.
Query key
["capxul", "org", orgId, "auditLog"] — org-scoped, keyed under the same
hierarchy as the org's other reads.
Errors
Today every fetch fails: the published client resolves a not-implemented
CapxulError for this read. Treat error as
the steady state until Capability status grades
this capability as live.
Client method
This hook wraps client.org(orgId).auditLog() — the
entity-scoped org bundle on the core SDK.