SettingsSet the event-contract alert webhook

Set the event-contract alert webhook

Turn the daily event-contract digest on or off for a location. Requires an agency key (ak_) and ?location_id=; viewer keys get 403 agency_required.

One webhook per location, not per contract, and that is deliberate: the most common thing worth alerting about is a tracking outage, which breaks every contract on the location at once. Per-contract delivery would send thirty alerts for one cause.

The sweep runs daily at ~08:00 UTC over the previous whole UTC day (closed, so late-arriving data has landed). It POSTs only when the alertable condition set changes — a violation that persists for a month is one alert, and the recovery is one more. Delivery must return 2xx for that state to advance, so a failed POST is retried on the next day's sweep.

Set secret (16+ characters) to have each POST carry an X-Mythic-Signature header: sha256= followed by the HMAC-SHA256 of the raw request body. Pass webhook_url: null to disable, which also clears the stored state so re-enabling later reports the current condition rather than staying silent about one that broke during the gap.

Per-event volume thresholds are not set here — they live on the contract as min_daily_events.

curl -X PUT "https://mythic-analytics.gulp.workers.dev/client/v1/settings/contract-alerts" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "webhook_url": "https://hooks.example.com/mythic/contracts",
  "secret": "example_string"
}'
{
  "success": true,
  "data": {
    "webhook_url": "https://hooks.example.com/mythic/contracts",
    "signed": true,
    "enabled": true,
    "last_sent_at": "2024-12-25T10:00:00Z",
    "schedule": "daily, ~08:00 UTC, for the previous whole UTC day"
  }
}
PUT
/contract-alerts
PUT
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Builder/client key as a bearer token. Agency key for read-write (Bearer ak_...) or viewer key for read-only (Bearer sk_...). Scoped keys (mcp_) are accepted too and need settings:read or settings:write. See Using an mcp_ key over HTTP.

Builder/client key as a bearer token. Agency key for read-write (Bearer ak_...) or viewer key for read-only (Bearer sk_...). Scoped keys (mcp_) are accepted too and need settings:read or settings:write. See Using an mcp_ key over HTTP.
Content-Typestring
Required

The media type of the request body

Options: application/json
webhook_urlstring
Required

HTTPS endpoint for the daily digest, or null to disable. Plain http:// is rejected — the payload names which of a client's events are broken, and a signature does not make plaintext private.

secretstring

Shared secret for X-Mythic-Signature. Omit to leave the current secret untouched; pass null to send unsigned. Never returned by a GET.

Min length: 16
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Builder/client key as a bearer token. Agency key for read-write (Bearer ak_...) or viewer key for read-only (Bearer sk_...). Scoped keys (mcp_) are accepted too and need settings:read or settings:write. See Using an mcp_ key over HTTP.

Body

application/json
webhook_urlstring
Required

HTTPS endpoint for the daily digest, or null to disable. Plain http:// is rejected — the payload names which of a client's events are broken, and a signature does not make plaintext private.

Example:
https://hooks.example.com/mythic/contracts
secretstring

Shared secret for X-Mythic-Signature. Omit to leave the current secret untouched; pass null to send unsigned. Never returned by a GET.

Responses

successboolean
dataobject