Auth API reference

Auth API · App-Audit-Sink

put/v1/apps/{app_id}/audit-sinkAuth

Create or replace the audit sink. Returns a freshly generated signing secret exactly once.

Audit rows are POSTed in batches of up to 100, signed with the same `X-Auth-Signature: t=<unix>,v1=<hex>` HMAC header as the outbound webhooks. Delivery is at-least-once: the cursor advances only after a 2xx, so a batch that times out after the receiver processed it is re-sent. Every record carries its immutable `audit_log` id, so dedupe on that. A new sink starts from the moment it is created — configuring one does not replay the existing history into your SIEM. Replacing an existing sink clears the auto-disabled state (the same "I fixed my receiver" signal a webhook PUT carries) but does NOT rewind the cursor.

Path parameters

app_id*string

Id of the app.

Request body

url*string

HTTPS endpoint that receives batched audit rows. Validated at config time AND re-resolved on every delivery, so a URL that later points at a private address is refused rather than dialled.

Example: "https://siem.customer.example.com/ingest/productcraft-auth"

Response · 200 Sink configured. `signing_secret` is shown only here.

id*string

Unique identifier of the audit sink.

app_id*string

The Auth app the audit sink belongs to.

url*string

HTTPS endpoint that receives the batched audit rows.

signing_secret_hint*string

Last 4 chars of the signing secret.

enabled*boolean

Whether the audit sink is enabled.

disabled_at*string · date-time

When 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*number

Failed deliveries in a row; a success resets it.

last_delivered_at*string · date-time

When 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-time

Most 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*boolean

Whether the receiver accepted the most recent attempt (2xx).

last_attempt_status_code*number

HTTP status of the most recent attempt; null when no response arrived (DNS, TLS, timeout, refused address).

Example: 200

last_error*string

Why 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-time

When the receiver last accepted a test batch. Cleared when the address or the signing secret changes.

created_at*string · date-time

When the audit sink was created (ISO 8601).

updated_at*string · date-time

When the audit sink was last changed (ISO 8601).

signing_secret*string

Plaintext signing secret. Returned exactly once, here. Only the encrypted envelope is stored.

Example

Request

PUT 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"
}

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",
  "signing_secret": "string"
}