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"
}'
import requests
import json
url = "https://mythic-analytics.gulp.workers.dev/client/v1/settings/contract-alerts"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"webhook_url": "https://hooks.example.com/mythic/contracts",
"secret": "example_string"
}
response = requests.put(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://mythic-analytics.gulp.workers.dev/client/v1/settings/contract-alerts", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"webhook_url": "https://hooks.example.com/mythic/contracts",
"secret": "example_string"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"webhook_url": "https://hooks.example.com/mythic/contracts",
"secret": "example_string"
}`)
req, err := http.NewRequest("PUT", "https://mythic-analytics.gulp.workers.dev/client/v1/settings/contract-alerts", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://mythic-analytics.gulp.workers.dev/client/v1/settings/contract-alerts')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"webhook_url": "https://hooks.example.com/mythic/contracts",
"secret": "example_string"
}'
response = http.request(request)
puts response.body
{
"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"
}
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Forbidden",
"message": "You don't have permission to access this resource",
"code": 403
}
/contract-alerts
Target server for requests. Edit to use your own host.
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.
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.The media type of the request body
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.
Shared secret for X-Mythic-Signature. Omit to leave the current secret untouched; pass null to send unsigned. Never returned by a GET.
Request Preview
Response
Response will appear here after sending the request
Authentication
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
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.
https://hooks.example.com/mythic/contractsShared secret for X-Mythic-Signature. Omit to leave the current secret untouched; pass null to send unsigned. Never returned by a GET.