ContractsRank the events to put a contract on

Rank the events to put a contract on

Every event that fired in the window, plus every event wired to an ad platform, ranked by tier: optimized (delivered to Meta, Google Ads, GA4, or OpenAI Ads as a conversion), mapped (wired and firing, nothing delivered), conversion_name (named like a conversion, not sent anywhere), sent (upper-funnel signal), not_firing (wired as a conversion, never fired), other. Within a tier, by deliveries then volume.

Mythic does not read campaign optimization goals, so optimized means what Mythic sends as a conversion, not what each campaign bids on. Internal $-prefixed events that no ad platform receives are hidden unless include_internal=1.

curl -X GET "https://mythic-analytics.gulp.workers.dev/client/v1/contracts/candidates?location_id=example_string&days=30&include_internal=0&limit=200&goals=0" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "success": true,
  "data": {
    "window": {
      "days": 30,
      "date_from": "2026-09-19"
    },
    "meta_goals": {
      "available": true,
      "reason": "example_string",
      "source": "managed",
      "ad_sets_synced": true,
      "goals": [
        {
          "platform": "meta_ads",
          "meta_event": "Purchase",
          "kind": "standard",
          "spend": 3210.5,
          "currency": "USD",
          "ad_sets": 4,
          "campaigns": 2,
          "pixel_ids": [
            "example_string"
          ]
        }
      ],
      "unmatched": [
        {
          "platform": "meta_ads",
          "meta_event": "Purchase",
          "kind": "standard",
          "spend": 3210.5,
          "currency": "USD",
          "ad_sets": 4,
          "campaigns": 2,
          "pixel_ids": [
            "example_string"
          ]
        }
      ],
      "other_goals": [
        {
          "optimization_goal": "LINK_CLICKS",
          "spend": 3.14
        }
      ]
    },
    "deliveries_available": true,
    "summary": {
      "candidates": 14,
      "by_tier": {
        "optimized": 2,
        "mapped": 0,
        "conversion_name": 1,
        "sent": 1,
        "not_firing": 1,
        "other": 9
      },
      "optimized_without_contract": [
        "purchase"
      ]
    },
    "candidates": [
      {
        "event": "purchase",
        "tier": "campaign_goal",
        "has_contract": false,
        "total_events": 1240,
        "unique_users": 1180,
        "delivered": 2470,
        "reason": "Sent as a conversion to Meta as Purchase 1,240 times, Google Ads (conversion action 987654) 1,230 times.",
        "campaign_goals": [
          {
            "platform": "meta_ads",
            "meta_event": "Purchase",
            "kind": "standard",
            "spend": 3210.5,
            "currency": "USD",
            "ad_sets": 4,
            "campaigns": 2,
            "pixel_ids": [
              "example_string"
            ]
          }
        ],
        "destinations": [
          {
            "source": "server",
            "destination_type": "meta_capi",
            "platform": "Meta",
            "action_id": "example_string",
            "name": "John Doe",
            "target": "Purchase",
            "conversion": true,
            "enabled": true,
            "delivered": 42,
            "failed_attempts": 42,
            "last_delivered_at": "2026-10-19 10:00:00.000"
          }
        ]
      }
    ],
    "truncated": false,
    "note": "example_string"
  }
}
GET
/client/v1/contracts/candidates
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
daysinteger

Window in days.

Min: 1 • Max: 90
query
include_internalstring

Set to 1 to keep $-prefixed SDK events that are not sent to an ad platform.

Options: 0, 1
query
limitinteger
Min: 1 • Max: 500
query
goalsstring

Set to 0 to skip reading the Meta ad set optimization goals.

Options: 0, 1
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_.

daysinteger

Window in days.

include_internalstring

Set to 1 to keep $-prefixed SDK events that are not sent to an ad platform.

Allowed values:01
goalsstring

Set to 0 to skip reading the Meta ad set optimization goals.

Allowed values:01

Responses

successboolean
dataobject