ConstraintsSet the benchmark targets for one scope

Set the benchmark targets for one scope

Store targets for the account (omit campaign) or for a single campaign (campaign = its Meta id or name, matched case-insensitively against both). Requires an agency key (ak_) — sk_ keys are read-only. This REPLACES the scope. The body is the complete set of targets for it, so a step you previously stored and now omit is cleared and falls back to the next source in precedence. The response echoes the resulting state so the replacement is never invisible. Rates are fractions between 0 and 1 — a 2% CTR target is 0.02. A value above 1 is rejected rather than interpreted. Prefer keying by campaign id: a name-keyed target stops matching when the campaign is renamed. The analysis reports matched_rows: 0 for a target that hit nothing, which is how you spot one that has gone stale.

curl -X PUT "https://mythic-analytics.gulp.workers.dev/client/v1/constraints/benchmarks?location_id=example_string" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "campaign": "120210000000000000",
  "benchmarks": {
    "ad": 0.02,
    "landing": 0.1
  },
  "note": "Q3 client contract"
}'
{
  "success": true,
  "data": {
    "default": {
      "ad": 0.015
    },
    "default_notes": {},
    "campaigns": [
      {
        "campaign": "example_string",
        "benchmarks": {},
        "notes": {}
      }
    ],
    "updated_at": "2024-12-25T10:00:00Z",
    "precedence": [
      "example_string"
    ],
    "valid_steps": [
      "ad"
    ],
    "saved": {
      "scope": "example_string",
      "campaign": "example_string",
      "benchmarks": {}
    },
    "note": "example_string"
  }
}
PUT
/client/v1/constraints/benchmarks
PUT
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 constraints:read or constraints:write. See Using an mcp_ key over HTTP.

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

The media type of the request body

Options: application/json
campaignstring

Campaign id or name. Omit (or send null) for the account-wide default scope.

benchmarksobject
Required

Step → rate. Valid steps are ad, tracking, landing, sales, site. Unlike the query params, a stored scope may hold both site and landing/sales targets — which apply depends on whether the analysis request passes lead_event, and the analysis reports any that sat out.

notestring

Where the target came from (client contract, category median). Surfaced next to the verdict it produced, so a benchmark is always traceable.

Max length: 500
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 constraints:read or constraints:write. See Using an mcp_ key over HTTP.

Query Parameters

Body

application/json
campaignstring

Campaign id or name. Omit (or send null) for the account-wide default scope.

benchmarksobject
Required

Step → rate. Valid steps are ad, tracking, landing, sales, site. Unlike the query params, a stored scope may hold both site and landing/sales targets — which apply depends on whether the analysis request passes lead_event, and the analysis reports any that sat out.

Example:
{"ad":0.02,"landing":0.1}
notestring

Where the target came from (client contract, category median). Surfaced next to the verdict it produced, so a benchmark is always traceable.

Responses

successboolean
datastring