ContractsShow the events behind one violation

Show the events behind one violation

The drill-down for a single violation. /violations tells you value is absent on 4,102 of 10,000 order_completed; this returns the most recent events that are actually missing it, with session_id and page URL, so you can see which template or campaign is responsible.

Every violation in the /violations response carries a ready-to-call samples link with the right parameters already filled in — you rarely need to build this URL by hand.

Deliberately never sampled: sampling a search for rare events returns a confident empty result. It stays cheap by reading newest-first and stopping once it has limit rows, so the volume of the event name barely matters when matches exist. The one slow case is a violation with no matching events at all — proving that requires reading every event of that name — which returns window_too_large.

curl -X GET "https://mythic-analytics.gulp.workers.dev/client/v1/contracts/samples?location_id=example_string&event=order_completed&key=value&kind=missing_required&date_from=2026-07-27&date_to=2026-08-03&limit=5" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "success": true,
  "data": {
    "event": "order_completed",
    "key": "value",
    "kind": "missing_required",
    "expected_type": "example_string",
    "window": {
      "date_from": "last 1 day",
      "date_to": "now",
      "sample": {
        "keeping": "1/10 of events",
        "note": "example_string"
      }
    },
    "samples": [
      {
        "event_id": "018f2c1a-7b3e-7c9d-a1b2-c3d4e5f60718",
        "session_id": "sess_9f2c1a7b",
        "distinct_id": "example_string",
        "timestamp": "2024-12-25T10:00:00Z",
        "url": "https://shop.example.com/checkout/thank-you",
        "observed_type": "absent",
        "value_sample": "example_string"
      }
    ],
    "note": "example_string"
  }
}
GET
/client/v1/contracts/samples
GET
Base URLstring

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

Bearer Token
Bearer Tokenstring
Required

Agency key (ak_) or location secret key (sk_). Scoped keys (mcp_) are accepted too and need contracts:read or contracts:write. See Using an mcp_ key over HTTP.

Agency key (ak_) or location secret key (sk_). Scoped keys (mcp_) are accepted too and need contracts:read or contracts:write. See Using an mcp_ key over HTTP.
query
location_idstring

Location to scope to. Required for ak_ keys (or send the X-Location-Id header); ignored for sk_.

query
eventstring
Required

Event name the violation is on.

query
keystring
Required

The violating property key.

query
kindstring

Which violation to find examples of. type_mismatch reads the expected type from the stored contract — it cannot be supplied as a parameter, so you cannot "find" mismatches against a type you never declared.

Options: missing_required, null_value, type_mismatch
query
date_fromstring

Start of the window, ISO 8601 date or timestamp. Defaults to 1 day ago.

query
date_tostring

End of the window (inclusive day), ISO 8601. Defaults to now.

query
limitinteger
Min: 1 • Max: 50
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Agency key (ak_) or location secret key (sk_). Scoped keys (mcp_) are accepted too and need contracts:read or contracts:write. See Using an mcp_ key over HTTP.

Query Parameters

location_idstring

Location to scope to. Required for ak_ keys (or send the X-Location-Id header); ignored for sk_.

eventstring
Required

Event name the violation is on.

Example:
order_completed
keystring
Required

The violating property key.

Example:
value
kindstring

Which violation to find examples of. type_mismatch reads the expected type from the stored contract — it cannot be supplied as a parameter, so you cannot "find" mismatches against a type you never declared.

Allowed values:missing_requirednull_valuetype_mismatch
date_fromstring

Start of the window, ISO 8601 date or timestamp. Defaults to 1 day ago.

Example:
2026-07-27
date_tostring

End of the window (inclusive day), ISO 8601. Defaults to now.

Example:
2026-08-03

Responses

successboolean
dataobject