Stream the audit entries to a bucket or a webhook
Adds a destination. A bucket (`s3`, `gcs` or `azure`) takes one JSON Lines object for each batch, written with the
better-auth.session_token<token>Better Auth session cookie. Production uses the __Secure- prefixed name.
Idempotency-Key?stringMakes retries safe. A repeated key with the same request returns the first result and sets
Idempotent-Replayed: true. The same key with a different request answers 409
idempotency.key_reused, and while the first request is still running 409
idempotency.in_progress. Results are kept for 24 hours. Server errors and refusals for lack
of sign-in or permission are not kept, so a retry runs again.
^[A-Za-z0-9_.:-]+$1 <= length <= 255application/json- body
kind*AuditStreamSinkKind"s3""gcs""azure""webhook"config*Where the destination is; which fields apply depends on the kind. s3 has bucket, region, accessKeyId and
prefix; gcs has bucket and prefix; azure has account, container and prefix; webhook has url.
It never holds a credential.
secret?stringThe credential the bucket is written with: the S3 secret access key, the Google service account key (the JSON file) or the Azure shared access signature. Required for a bucket and refused for a webhook. It is stored sealed and never returned.
length <= 8192enabled?booleantrueincludeHistory?booleanAlso send the entries that were already kept, from the oldest. Otherwise streaming starts after the newest.
falseThe destination, and for a webhook its signing secret.
application/json- response
sink*signingSecret?stringA webhook's signing secret. It is shown here once and cannot be read again.
curl -X POST 'https://wardn.example.com/api/v1/organization/audit-stream/sinks' \ -H 'Content-Type: application/json' \ -d '{ "kind": "s3", "config": {}}'{ "sink": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "kind": "s3", "config": { "bucket": "string", "region": "string", "accessKeyId": "string", "account": "string", "container": "string", "prefix": "string", "url": "string" }, "enabled": true, "state": "active", "secretHint": "string", "lastDeliveredAt": "2019-08-24T14:15:22Z", "lastDeliveredSeq": 0, "failingSince": "2019-08-24T14:15:22Z", "lastError": "string", "pausedAt": "2019-08-24T14:15:22Z", "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }, "signingSecret": "string"}Where the organization's audit entries are streamed to GET
The destinations the organization sends its audit entries to, at most two, one of each kind. A destination's
Stop streaming to a destination DELETE
Removes the destination and its saved credential. Nothing more is sent to it. Needs `audit:stream`.