/v1/apps/{app_id}/audit-sinkAuthChange the address or switch export on or off, keeping the signing secret.
Send `url`, `enabled` or both. `enabled: false` pauses export; `enabled: true` resumes it and clears a stop after repeated failures and the failure count. The position in the audit log is never moved: nothing is skipped and nothing is replayed twice on purpose. A new `url` is checked by the same address guard as `PUT`.
Path parameters
app_id*stringId of the app.
Request body
urlstringNew HTTPS address. The signing secret is kept (unlike `PUT`, which issues a new one). Changing it clears the receiver-test proof.
Example: "https://siem.customer.example.com/ingest/productcraft-auth"
enabledboolean`false` pauses export; `true` turns it back on and clears a stop after repeated failures. The position is kept either way: records written meanwhile are sent once export is on, within the audit log retention period.
Example: true
Response · 200 The updated sink.
id*stringUnique identifier of the audit sink.
app_id*stringThe Auth app the audit sink belongs to.
url*stringHTTPS endpoint that receives the batched audit rows.
signing_secret_hint*stringLast 4 chars of the signing secret.
enabled*booleanWhether the audit sink is enabled.
disabled_at*string · date-timeWhen the audit sink was disabled (ISO 8601), or `null` while enabled.
disabled_reason*string`manual` (switched off by a caller) or `failing` (switched off after failed deliveries); `null` while enabled.
consecutive_failures*numberFailed deliveries in a row; a success resets it.
last_delivered_at*string · date-timeWhen a batch was last accepted (2xx) by the receiver.
state*object`active`: sending. `paused`: switched off with `PATCH { enabled: false }`. `auto_disabled`: stopped after repeated failures (`disabled_reason` says which); `PATCH { enabled: true }` or a `PUT` turns it back on.
Example: "active"
last_attempt_at*string · date-timeMost recent POST to the receiver, accepted or not (a real batch or a test).
last_attempt_kind*object`batch`: a real delivery. `test`: "Send test batch".
last_attempt_ok*booleanWhether the receiver accepted the most recent attempt (2xx).
last_attempt_status_code*numberHTTP status of the most recent attempt; null when no response arrived (DNS, TLS, timeout, refused address).
Example: 200
last_error*stringWhy the most recent attempt failed, in a short sentence; null after a success.
Example: "Your receiver answered HTTP 401: invalid signature"
last_test_succeeded_at*string · date-timeWhen the receiver last accepted a test batch. Cleared when the address or the signing secret changes.
created_at*string · date-timeWhen the audit sink was created (ISO 8601).
updated_at*string · date-timeWhen the audit sink was last changed (ISO 8601).
Example
Request
PATCH https://api.auth.productcraft.co/v1/apps/{app_id}/audit-sink
Authorization: Bearer YOUR_TOKEN
Content-Type: application/json
{
"url": "https://siem.customer.example.com/ingest/productcraft-auth",
"enabled": true
}import { Auth } from "@productcraft/auth";
// Admin routes read PRODUCTCRAFT_API_KEY; consumer routes need no key
const auth = new Auth();
const auditSink = await auth.admin.app("3f0c3c1e-8a2b-4c55-9d3f-0a1b2c3d4e5f").auditSink.update({ enabled: true });auth.admin.app(…).auditSink.update(params?, options?): Auth.AuditSink
Response
{
"id": "string",
"app_id": "string",
"url": "string",
"signing_secret_hint": "string",
"enabled": false,
"disabled_at": "2026-01-01T00:00:00.000Z",
"disabled_reason": "string",
"consecutive_failures": 0,
"last_delivered_at": "2026-01-01T00:00:00.000Z",
"state": "active",
"last_attempt_at": "2026-01-01T00:00:00.000Z",
"last_attempt_kind": {},
"last_attempt_ok": false,
"last_attempt_status_code": 200,
"last_error": "Your receiver answered HTTP 401: invalid signature",
"last_test_succeeded_at": "2026-01-01T00:00:00.000Z",
"created_at": "2026-01-01T00:00:00.000Z",
"updated_at": "2026-01-01T00:00:00.000Z"
}