Access
Preview

Change a destination of the audit stream

Replaces the destination's `config` and switches it on or off. The kind cannot change. A `secret` is replaced only

PUT
/organization/audit-stream/sinks/{sinkId}
cookiebetter-auth.session_token<token>

Better Auth session cookie. Production uses the __Secure- prefixed name.

sinkId*string
Formatuuid
Idempotency-Key?string

Makes 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.

Match^[A-Za-z0-9_.:-]+$
Length1 <= length <= 255
application/json
  1. body
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?string

A new credential. Left out, the saved one is kept.

Lengthlength <= 8192
enabled?boolean
Defaulttrue

Response Body

The destination.

application/json
  1. response
id*string
Formatuuid
kind*AuditStreamSinkKind
Value in"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.

enabled*boolean
state*AuditStreamSinkState

active delivers, failing is retrying after a failure with growing waits, paused failed for a day and sends nothing until it is saved again or a test reaches it, disabled was switched off.

Value in"active""failing""paused""disabled"
secretHint*string

The last four characters of a webhook's signing secret, to tell two apart; empty for a bucket.

lastDeliveredAt*|
Formatdate-time
lastDeliveredSeq*integer

The highest audit entry the destination was given.

Formatint64
failingSince*|

When the current run of failures began; null when the last delivery worked.

Formatdate-time
lastError*string

What to tell a person about the last failure; empty when there is none.

pausedAt*|
Formatdate-time
createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
Example Request
curl -X PUT 'https://wardn.example.com/api/v1/organization/audit-stream/sinks/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{  "config": {}}'
Example Response
{  "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"}