Segment offers an in-app 90 day Audit Trail for Business Tier accounts.
The Segment Public API lets you automate consuming these Audit Trail events.
Returns a list of Audit Trail events.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.auditTrail.listAuditEvents()) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "events": [
- {
- "id": "events/145876976",
- "timestamp": "2022-03-04T21:29:22Z",
- "type": "Source Function Deleted",
- "actor": "public-api-token/TJ7z8cg6",
- "resourceId": "8AWE8yZRdy",
- "resourceType": "function",
- "resourceName": "Foo Func 543"
}, - {
- "id": "events/145876978",
- "timestamp": "2022-03-04T21:29:22Z",
- "type": "Source Function Modified",
- "actor": "public-api-token/TJ7z8cg6",
- "resourceId": "sfnc_tFXvS0Rs6T",
- "resourceType": "function",
- "resourceName": "displayName"
}
], - "pagination": {
- "current": "eyJwYWdlVG9rZW4iOiJNUT09IiwiZW5kVGltZSI6IjIwMjQtMDItMDdUMDA6MDQ6MDQuMjY2WiJ9",
- "next": "eyJwYWdlVG9rZW4iOiJNZz09IiwiZW5kVGltZSI6IjIwMjQtMDItMDdUMDA6MDQ6MDQuMjY2WiJ9"
}
}
}