ContractsApply a contract pack

Apply a contract pack

Stores every contract in the pack for this location in one call.

Same replace rule as PUT, applied per event: each event in the pack replaces that event's property set. Events NOT in the pack are left alone — this adds and overwrites, it never deletes, so a hand-written contract for one of your own events survives.

Read-only enforcement, unchanged: applying a pack turns on the violation report for those events. Nothing is rejected, quarantined or dropped at ingestion.

Pass dry_run=true to see exactly what would be stored without storing it. Agency key (ak_) required.

curl -X POST "https://mythic-analytics.gulp.workers.dev/client/v1/contracts/presets/commerce?dry_run=true&location_id=example_string" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "success": true,
  "data": {
    "preset": "commerce",
    "applied": 13,
    "dry_run": true,
    "events": [
      "view_item",
      "add_to_cart",
      "begin_checkout",
      "purchase"
    ],
    "contracts": [
      {
        "event": "purchase",
        "properties": {},
        "note": "example_string"
      }
    ],
    "note_on_semantics": "example_string"
  }
}
POST
/client/v1/contracts/presets/{preset}
POST
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.
path
presetstring
Required

Pack id. Currently: commerce.

query
dry_runboolean

Return what would be written without writing it.

query
location_idstring

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

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.

Path Parameters

presetstring
Required

Pack id. Currently: commerce.

Example:
commerce

Query Parameters

dry_runboolean

Return what would be written without writing it.

location_idstring

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

Responses

successboolean
dataobject