Skip to content

Audit Logs

Retrieve audit log records for events recorded by the policy engine. All endpoints in this section require the ADMIN role.

Required Role

ADMIN

Headers

HeaderValueRequired
AuthorizationBearer <token>Yes
X-Tenant-IDTenant identifier stringYes

Get All Audit Logs

Retrieve a list of all audit log entries for the tenant, ordered by event time descending.

Endpoint

GET /api/v1/audit

Response Body

json
[
  {
    "id": "string",
    "eventType": "string",
    "policyModule": "string",
    "policyFunction": "string",
    "actorId": "string",
    "occurredAt": "2024-01-15T10:30:00Z",
    "payload": {},
    "hash": "string",
    "previousHash": "string"
  }
]
FieldTypeDescription
idstringUnique audit record identifier.
eventTypestringThe type of event that was recorded (e.g. POLICY_EVALUATED, POLICY_DEPLOYED).
policyModulestringModule name associated with the event, if applicable.
policyFunctionstringFunction name associated with the event, if applicable.
actorIdstringIdentifier of the user or service principal that triggered the event.
occurredAtstringISO 8601 timestamp of when the event occurred.
payloadobjectEvent-specific metadata. Structure varies by eventType.
hashstringSHA-256 hash of this record's content, used for chain integrity verification.
previousHashstringHash of the immediately preceding audit record, forming the hash chain.

Examples

bash
curl -X GET https://policy.aster-lang.dev/api/v1/audit \
  -H "Authorization: Bearer <token>" \
  -H "X-Tenant-ID: acme-corp"
js
const response = await fetch(
  'https://policy.aster-lang.dev/api/v1/audit',
  {
    headers: {
      Authorization: 'Bearer <token>',
      'X-Tenant-ID': 'acme-corp',
    },
  }
);

const logs = await response.json();

Filter by Event Type

Retrieve audit log entries filtered to a specific event type.

Endpoint

GET /api/v1/audit/type/{eventType}

Path Parameters

ParameterTypeDescription
eventTypestringThe event type to filter by (e.g. POLICY_EVALUATED, POLICY_DEPLOYED, POLICY_ROLLED_BACK).

Examples

bash
curl -X GET https://policy.aster-lang.dev/api/v1/audit/type/POLICY_DEPLOYED \
  -H "Authorization: Bearer <token>" \
  -H "X-Tenant-ID: acme-corp"
js
const eventType = 'POLICY_DEPLOYED';
const response = await fetch(
  `https://policy.aster-lang.dev/api/v1/audit/type/${eventType}`,
  {
    headers: {
      Authorization: 'Bearer <token>',
      'X-Tenant-ID': 'acme-corp',
    },
  }
);

const logs = await response.json();

Filter by Policy

Retrieve audit log entries for a specific policy module and function combination.

Endpoint

GET /api/v1/audit/policy/{policyModule}/{policyFunction}

Path Parameters

ParameterTypeDescription
policyModulestringThe fully-qualified module name (e.g. Loan.Approval).
policyFunctionstringThe function name within the module (e.g. isEligible).

Examples

bash
curl -X GET "https://policy.aster-lang.dev/api/v1/audit/policy/Loan.Approval/isEligible" \
  -H "Authorization: Bearer <token>" \
  -H "X-Tenant-ID: acme-corp"
js
const policyModule = 'Loan.Approval';
const policyFunction = 'isEligible';
const response = await fetch(
  `https://policy.aster-lang.dev/api/v1/audit/policy/${policyModule}/${policyFunction}`,
  {
    headers: {
      Authorization: 'Bearer <token>',
      'X-Tenant-ID': 'acme-corp',
    },
  }
);

const logs = await response.json();

Filter by Time Range

Retrieve audit log entries within a specific time window.

Endpoint

GET /api/v1/audit/range

Query Parameters

ParameterTypeRequiredDescription
startTimestringYesISO 8601 start timestamp (inclusive).
endTimestringYesISO 8601 end timestamp (inclusive).

Examples

bash
curl -X GET "https://policy.aster-lang.dev/api/v1/audit/range?startTime=2024-01-01T00:00:00Z&endTime=2024-01-31T23:59:59Z" \
  -H "Authorization: Bearer <token>" \
  -H "X-Tenant-ID: acme-corp"
js
const params = new URLSearchParams({
  startTime: '2024-01-01T00:00:00Z',
  endTime:   '2024-01-31T23:59:59Z',
});

const response = await fetch(
  `https://policy.aster-lang.dev/api/v1/audit/range?${params}`,
  {
    headers: {
      Authorization: 'Bearer <token>',
      'X-Tenant-ID': 'acme-corp',
    },
  }
);

const logs = await response.json();

HTTP Status Codes

StatusMeaning
200 OKRequest succeeded. Returns an array of audit log entries (may be empty).
400 Bad RequestMissing or malformed query parameters.
401 UnauthorizedMissing or invalid bearer token.
403 ForbiddenToken is valid but the caller lacks the ADMIN role.
500 Internal Server ErrorUnexpected engine failure.

Released under the MIT License.