{
 "openapi": "3.1.0",
 "info": {
  "title": "KRIN API",
  "version": "2026-12-04",
  "summary": "The rewarded performance network your AI can run.",
  "description": "The KRIN REST API for advertisers, publishers and the wall. Authenticate with a secret API key or an OAuth token, send the `Krin-Version` header, and use `Idempotency-Key` on writes. Money is integer micro-USD and errors are problem+json with stable codes. Read the [introduction](/api/) first.",
  "contact": {
   "name": "KRIN AI LLC",
   "url": "https://krin.io"
  },
  "license": {
   "name": "Proprietary",
   "identifier": "LicenseRef-KRIN-Proprietary"
  }
 },
 "servers": [
  {
   "url": "https://api.krin.io",
   "description": "Production (live and sandbox orgs; sandbox is a mode of the org, not a host)"
  }
 ],
 "security": [
  {
   "apiKey": []
  },
  {
   "oauth2": []
  }
 ],
 "tags": [
  {
   "name": "org",
   "description": "Organization, members, keys, agents, audit (both sides)"
  },
  {
   "name": "advertiser",
   "description": "Advertiser workspace"
  },
  {
   "name": "publisher",
   "description": "Publisher workspace"
  },
  {
   "name": "wall",
   "description": "End-user wall (wall.krin.io) and headless ranked offers"
  },
  {
   "name": "shared",
   "description": "Rules, decisions, reports, search, webhooks, sandbox, AI"
  },
  {
   "name": "tracking",
   "description": "t.krin.io click redirect and inbound conversion postbacks"
  }
 ],
 "paths": {
  "/v1/org": {
   "get": {
    "operationId": "org.get",
    "tags": [
     "org"
    ],
    "summary": "Get organization",
    "description": "Current organization (sides, KYB, publisher tier and terms, advertiser track)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Organization"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "patch": {
    "operationId": "org.update",
    "tags": [
     "org"
    ],
    "summary": "Update organization",
    "description": "Update organization profile fields (name, legal name, country, website)",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OrganizationUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Organization"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/sides": {
   "post": {
    "operationId": "org.sides.enable",
    "tags": [
     "org"
    ],
    "summary": "Add workspace",
    "description": "Enable the advertiser or publisher side. Opens that side's ledger accounts.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "side"
        ],
        "additionalProperties": false,
        "properties": {
         "side": {
          "$ref": "#/components/schemas/Side"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Organization"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/members": {
   "get": {
    "operationId": "org.members.list",
    "summary": "List members",
    "tags": [
     "org"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/MemberPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "org.members.invite",
    "summary": "Invite member",
    "tags": [
     "org"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MemberInvite"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Invited",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Member"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/members/{member_id}": {
   "parameters": [
    {
     "name": "member_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/MemberId"
     }
    }
   ],
   "patch": {
    "operationId": "org.members.update",
    "tags": [
     "org"
    ],
    "summary": "Update member",
    "description": "Change role or sides. Making someone owner is human-only (agent policy).",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MemberUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Member"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "delete": {
    "operationId": "org.members.remove",
    "summary": "Remove member",
    "tags": [
     "org"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "204": {
      "description": "Removed"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/api-keys": {
   "get": {
    "operationId": "org.api_keys.list",
    "summary": "List API keys",
    "tags": [
     "org"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ApiKeyPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "org.api_keys.create",
    "tags": [
     "org"
    ],
    "summary": "Create API key",
    "description": "Create a secret key (krin_sk_live_ or krin_sk_test_) for one side. The secret is returned once.\n\nAn owner or admin, in the console, signed in with a passkey (403 passkey_session_required). The key works on api.krin.io as Authorization: Bearer krin_sk_.. for the operations its scopes cover on its side; it never runs an operation a person must run (human_only), a money move or an operation marked passkey_session (403 not_for_api_keys). KRIN keeps only an HMAC of the key and shows its first 21 characters (key_prefix). A key with any write scope expires within 365 days; a read-only key may have no expiry. A test key (is_test) is made, and works, only while the organization is in sandbox. A retry with the same Idempotency-Key answers 409 secret_already_shown. 404 while API keys are off.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ApiKeyCreate"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ApiKeyCreated"
        }
       }
      }
     },
     "409": {
      "description": "secret_already_shown: an Idempotency-Key retry; create a new key if it was lost",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/api-keys/{key_id}": {
   "parameters": [
    {
     "name": "key_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^key_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     }
    }
   ],
   "delete": {
    "operationId": "org.api_keys.revoke",
    "summary": "Revoke API key",
    "tags": [
     "org"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "204": {
      "description": "Revoked"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/agent-connections": {
   "get": {
    "operationId": "org.agent_connections.list",
    "tags": [
     "org"
    ],
    "summary": "List agent connections",
    "description": "AI agents connected to this org over MCP (OAuth 2.1)",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentConnectionPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/agent-connections/{agent_id}": {
   "parameters": [
    {
     "name": "agent_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^agt_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     }
    }
   ],
   "delete": {
    "operationId": "org.agent_connections.revoke",
    "summary": "Revoke agent connection",
    "tags": [
     "org"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "204": {
      "description": "Revoked; all tokens of this connection stop working immediately"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/health": {
   "get": {
    "operationId": "org.health.get",
    "tags": [
     "org"
    ],
    "summary": "Get account health",
    "description": "Account health for the calling side (integration, deliveries, checks, balance runway, level progress). The account own operational facts only.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AccountHealth"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/agent-policy": {
   "get": {
    "operationId": "org.agent_policy.get",
    "tags": [
     "org"
    ],
    "summary": "Get agent policy",
    "description": "The owner-set agent policy and the fixed human-only list.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentPolicy"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "put": {
    "operationId": "org.agent_policy.set",
    "tags": [
     "org"
    ],
    "summary": "Set agent policy",
    "description": "Set the agent policy. Agents can never raise their own limits (abuse case 8).",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AgentPolicyInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AgentPolicy"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/audit-events": {
   "get": {
    "operationId": "org.audit_events.list",
    "tags": [
     "org"
    ],
    "summary": "List audit events",
    "description": "Every write in this org with its actor (member, API key, agent, KRIN AI, rule). Recorded reads (a case or an end user looked up) are left out unless include_reads=true. Each event carries label, a short human name for its operation.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "actor_type",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/ActorType"
      }
     },
     {
      "name": "target_id",
      "in": "query",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "include_reads",
      "in": "query",
      "description": "true also lists recorded reads (GET operations); default false",
      "schema": {
       "type": "boolean",
       "default": false
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AuditEventPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/notifications": {
   "get": {
    "operationId": "org.notifications.list",
    "summary": "List notifications",
    "tags": [
     "org"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/NotificationPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/store-lookup": {
   "post": {
    "operationId": "advertiser.store.lookup",
    "tags": [
     "advertiser"
    ],
    "summary": "Look up store listing",
    "description": "Read a Google Play or App Store link and return the app's store details.\nThe link is never fetched: KRIN reads the app id from it and asks the store itself (iTunes lookup API, Google Play details page), no redirects, with a timeout and a size cap. Store text comes back as plain text; the icon is copied to cdn.krin.io (never a store-hosted URL) or left out. A web link is not a store link (422 unsupported_url): the Console asks for a web product's name instead.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "url"
        ],
        "additionalProperties": false,
        "properties": {
         "url": {
          "type": "string",
          "format": "uri",
          "maxLength": 2048
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/StoreLookup"
        }
       }
      }
     },
     "404": {
      "description": "store_not_found: the store has no public listing for this link (missing, or not public in the store country). The body carries platform, bundle_id and store_url for entry by hand.",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "product_exists: this organization already has a product for this app. The body carries product {id, name}.",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "422": {
      "description": "unsupported_url: not a Google Play or App Store app link",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "502": {
      "description": "store_unreachable: the store did not answer (timeout, redirect, oversize). The body carries platform, bundle_id and store_url.",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/products": {
   "get": {
    "operationId": "advertiser.products.list",
    "summary": "List products",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ProductPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "advertiser.products.create",
    "summary": "Create product",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ProductInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Product"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/products/{product_id}": {
   "parameters": [
    {
     "name": "product_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/ProductId"
     }
    }
   ],
   "get": {
    "operationId": "advertiser.products.get",
    "summary": "Get product",
    "tags": [
     "advertiser"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Product"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "patch": {
    "operationId": "advertiser.products.update",
    "summary": "Update product",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ProductInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Product"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/campaigns": {
   "get": {
    "operationId": "advertiser.campaigns.list",
    "summary": "List campaigns",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "product_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/ProductId"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CampaignPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "advertiser.campaigns.create",
    "summary": "Create campaign",
    "description": "A new campaign's budget is set only when the body chooses it (lifetime_budget_micros and/or daily_budget_micros, a number or null for no limit; a field left out means no limit) and the caller is a person with the owner, admin or finance role and a fresh passkey confirmation. Otherwise the campaign starts with budget_state not_set and the budget fields are ignored: this covers no budget fields, the developer role, an API key, an agent, and a missing confirmation. The create still succeeds, and budget_state in the answer shows which happened. A not_set campaign spends nothing until that person sets its budget with advertiser.campaigns.update.",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CampaignInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Campaign"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/campaigns/{campaign_id}": {
   "parameters": [
    {
     "name": "campaign_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/CampaignId"
     }
    }
   ],
   "get": {
    "operationId": "advertiser.campaigns.get",
    "summary": "Get campaign",
    "tags": [
     "advertiser"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Campaign"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "patch": {
    "operationId": "advertiser.campaigns.update",
    "tags": [
     "advertiser"
    ],
    "summary": "Update campaign",
    "description": "Budget, dates, pacing. Raising budgets counts against the agent policy's daily limit.\n\nA partial change: a field left out keeps its value. The developer, finance, admin and owner roles may lower a budget and change the name, pacing and dates. A raise needs the owner, admin or finance role and a passkey sign-in from the last 12 hours (403 passkey_session_required, 403 sign_in_too_old; 403 recent_new_device for 10 minutes after one of the person's passkeys changed), or 403 role_cannot_raise. Owners get a mail when a budget is set to no limit or raised above twice its value. A raise is a higher lifetime or daily budget, removing a budget, or, with no lifetime budget, a later end or an earlier start. A lifetime budget never goes below the spend already booked (422 budget_below_spend, with spend_micros). An ended campaign is not edited (409 invalid_transition). Never an API key. An agent raises only with a person's confirmation, or within the daily allowance the owner set for automatic money moves. On a campaign whose budget_state is not_set, a change that carries lifetime_budget_micros or daily_budget_micros (a number, or null for no limit) sets its budget for the first time: only a person with the owner, admin or finance role, with a passkey sign-in from the last 12 hours (403 human_member_required for API keys and agents, 403 role_cannot_raise for the developer role); other changes to it raise nothing. Budgets only cap spend: nothing is charged here.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CampaignUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Campaign"
        }
       }
      }
     },
     "409": {
      "description": "The campaign has ended (invalid_transition)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "422": {
      "description": "The lifetime budget is below the spend already booked (budget_below_spend, with spend_micros)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers": {
   "get": {
    "operationId": "advertiser.offers.list",
    "summary": "List offers",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/OfferStatus"
      }
     },
     {
      "name": "campaign_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/CampaignId"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOfferPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "advertiser.offers.create",
    "tags": [
     "advertiser"
    ],
    "summary": "Create offer",
    "description": "Create an offer in draft with its events, targeting, caps and tracking in one call.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AdvertiserOfferInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "get": {
    "operationId": "advertiser.offers.get",
    "summary": "Get offer",
    "tags": [
     "advertiser"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "patch": {
    "operationId": "advertiser.offers.update",
    "tags": [
     "advertiser"
    ],
    "summary": "Update offer",
    "description": "Update content, events, targeting, caps or tracking. Editing a live offer re-runs affected checks.\nOnly a draft, or an offer in needs_fix, is edited here (409 invalid_transition otherwise). A live or paused offer changes through advertiser.offers.changes.propose; an offer in checks or review is withdrawn to draft first. events replaces the milestones as a whole (an event_key kept keeps its id); caps replaces the caps (a kind left out has no cap). tracking is not accepted yet (400) until inbound postbacks open.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AdvertiserOfferUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/submit": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.offers.submit",
    "tags": [
     "advertiser"
    ],
    "summary": "Submit offer for review",
    "description": "Run automated checks (draft/needs_fix -> checking -> live, needs_fix or in_review)\n\nRuns every automated check and answers with the finished run. A failed check leaves the offer in needs_fix. Otherwise a person at KRIN reviews it: the first offer of an advertiser, a flagged vertical, a private offer, or any check that warned or could not run yet. While tracking checks and the AI policy check are not open, every passing offer goes to review. 404 while offer submission is not open; 409 invalid_transition unless the offer is a draft or needs fixes.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "202": {
      "description": "Checks started",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OfferCheckRun"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/checks": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "get": {
    "operationId": "advertiser.offers.checks",
    "tags": [
     "advertiser"
    ],
    "summary": "Get offer checks",
    "description": "Latest automated check run with a result per check key.\n\n404 no_check_run for an offer that was never submitted.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OfferCheckRun"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/withdraw": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.offers.withdraw",
    "tags": [
     "advertiser"
    ],
    "summary": "Withdraw offer",
    "description": "Withdraw an offer from checks or review back to draft.\n\nStops the checks or the review of an offer in checking or in_review and returns it to draft, where everything can be edited again. 404 while offer submission is not open; 409 invalid_transition in any other state.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/changes": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.offers.changes.propose",
    "tags": [
     "advertiser"
    ],
    "summary": "Propose offer change",
    "description": "Propose a change to a live or paused offer (texts, creatives, vertical, milestones, payouts, targeting)\nThe same automated checks run on the changed version; the live version keeps serving unchanged meanwhile. A failed check answers status needs_fix. Otherwise a person at KRIN reviews the change (while some checks cannot run yet, every change is reviewed); once approved it replaces the live version at once, and users who already clicked keep the payout and steps they saw. Existing milestones keep their event key, order and kind and are never removed; new milestones come after them. The reversal and attribution windows never change after submit, and caps have their own rules. A newer proposal replaces one still in review. 404 while offer submission is not open; 409 invalid_transition unless the offer is live or paused (edit a draft directly); 429 after offers.submits_per_offer_day submits and proposals for the offer in 24 hours.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OfferChangeInput"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Checks done: the change is in review, needs fixes, or was applied",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OfferChange"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/pause": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.offers.pause",
    "summary": "Pause offer",
    "description": "A live offer stops serving at once (audited). 404 while offer submission is not open; 409 invalid_transition unless live.",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/resume": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.offers.resume",
    "summary": "Resume offer",
    "description": "Lifts a pause the advertiser made. A pause KRIN made (rules, budget, a case) is lifted by KRIN: 409 invalid_transition.",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/end": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.offers.end",
    "summary": "End offer",
    "description": "A live or paused offer ends for good; a change still in review is withdrawn. 409 invalid_transition otherwise.",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/events": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "put": {
    "operationId": "advertiser.offers.events.set",
    "tags": [
     "advertiser"
    ],
    "summary": "Set offer events",
    "description": "Replace the offer events (milestones, event keys, cost per event)\n\nThe whole list of milestones. A draft or an offer that needs fixes takes it: a milestone is kept by its event_key (it keeps its id) and one left out is removed. A live or paused offer changes its milestones only through a pending change that KRIN reviews: send them with advertiser.offers.changes.propose; here they answer 409 pending_change_required and nothing changes (the same list it already has answers 200). Other states answer 409 invalid_transition. A milestone's time limit fits inside the attribution window, and a later milestone's time limit is never shorter than an earlier one's (400 at /events/{i}/time_limit_hours).",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OfferEventsInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/targeting": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "put": {
    "operationId": "advertiser.offers.targeting.set",
    "tags": [
     "advertiser"
    ],
    "summary": "Set offer targeting",
    "description": "Replace the offer targeting (countries, platforms, OS, languages, devices, new users only)\n\nThe whole targeting; an empty or missing list means all. A draft or an offer that needs fixes takes any targeting. A live or paused offer takes narrower targeting at once (fewer countries, platforms, languages or devices, more excluded countries, a higher minimum OS, new users only); wider targeting answers 409 pending_change_required: send it with advertiser.offers.changes.propose. Other states answer 409 invalid_transition.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Targeting"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/caps": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "put": {
    "operationId": "advertiser.offers.caps.set",
    "tags": [
     "advertiser"
    ],
    "summary": "Set offer caps",
    "description": "Replace the offer caps and budgets. A budget increase counts toward the agent daily budget-increase limit.\n\nThe whole set of offer caps: a cap left out means none. A draft or an offer that needs fixes takes any caps. A live or paused offer takes an added or lowered cap at once; raising or removing one answers 409 offer_locked with the caps it names. Other states answer 409 invalid_transition.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OfferCaps"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/age-facts": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "put": {
    "operationId": "advertiser.offers.age_facts.set",
    "tags": [
     "advertiser"
    ],
    "summary": "Set offer age rating",
    "description": "Replace the offer facts the wall uses for users under 18 (minimum age, store ratings, money and data steps)\n\nThe whole set; a fact left out or null is not known, and an offer with any fact not known is never shown to users under 18 (adults are not affected, except by min_age). Store ages: only for an app, per platform the offer runs on; KRIN reads the store rating in the same request, an empty value takes it, and a value you set may only be the same or higher (400 below it, 422 store_age_unverified when the store could not be read). A draft or an offer that needs fixes takes any values; a live or paused offer only stricter ones (a higher min_age, or 18 or more where none was set; higher store ages; a money or data step marked true): the other direction answers 409 pending_change_required.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OfferAgeFacts"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserOffer"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/tracking-tests": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.tracking.test",
    "tags": [
     "advertiser"
    ],
    "summary": "Test offer tracking",
    "description": "Fire a test click through the tracking chain and wait for the test postback.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "202": {
      "description": "Test started",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TrackingTest"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/tracking/mmp-key": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.tracking.rotate_mmp_key",
    "tags": [
     "advertiser"
    ],
    "summary": "Rotate MMP key",
    "description": "Create or rotate the offer's MMP key.\n\nThe key is returned once and never stored (only its HMAC); type it into the MMP's partner settings for KRIN (parameter k). The previous key keeps working for grace_hours (default tracking.mmp_key_grace_hours, at most 168; 0 ends it now). A person signed in with a passkey (403 passkey_session_required). A draft AppsFlyer, Adjust or Singular tracker without an inbound secret moves to the MMP route (mmp_ip_range) with its first key while KRIN holds that MMP's published ranges. Send {} for the defaults.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SecretRotationInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "New key (shown once)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/MmpKeyRotation"
        }
       }
      }
     },
     "409": {
      "description": "tracking_not_set_up, or secret_already_shown on an idempotent replay",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "422": {
      "description": "mmp_not_available: not an MMP tracker",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/tracking/inbound-secret": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.tracking.rotate_inbound_secret",
    "tags": [
     "advertiser"
    ],
    "summary": "Rotate postback secret",
    "description": "Create or rotate the offer's inbound postback secret.\n\nThe secret signs your server's postbacks to https://t.krin.io/pb/{offer_key}. It is returned once and kept only sealed; the offer shows its last 4 characters. The previous secret keeps verifying for grace_hours (default 24, at most 168; 0 ends it now). A person signed in with a passkey (403 passkey_session_required). Send {} for the defaults.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SecretRotationInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "New secret (shown once)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InboundSecretRotation"
        }
       }
      }
     },
     "409": {
      "description": "tracking_not_set_up, or secret_already_shown on an idempotent replay",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/tracking/mtls": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "put": {
    "operationId": "advertiser.tracking.set_mtls",
    "tags": [
     "advertiser"
    ],
    "summary": "Require client certificate",
    "description": "Require a client certificate on the offer's signed postbacks, or stop requiring one.\n\nWith required true, KRIN accepts the offer's signed postbacks only on https://s2s.krin.io/pb/{offer_key} with one of the offer's live client certificates (KRIN records them from your CSR), and refuses them on t.krin.io. It needs a live certificate (400 on /required without one) and a person (owner, admin or developer). Turning it off makes the tracker weaker: an owner or admin, signed in with a passkey, and every owner gets an email. The HMAC signature is checked either way: a certificate adds to it and never replaces it. Answers the offer's tracking.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "required"
        ],
        "additionalProperties": false,
        "properties": {
         "required": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OfferTracking"
        }
       }
      }
     },
     "409": {
      "description": "tracking_not_set_up",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/campaign-drafts": {
   "post": {
    "operationId": "advertiser.ai.draft_campaign",
    "tags": [
     "advertiser"
    ],
    "summary": "Draft campaign with AI",
    "description": "KRIN AI drafts a full multi-milestone campaign from a store URL (always dry-run; nothing is created)",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CampaignDraftRequest"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Draft",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CampaignDraft"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/conversions": {
   "get": {
    "operationId": "advertiser.conversions.list",
    "summary": "List conversions",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "offer_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/OfferId"
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/ConversionStatus"
      }
     },
     {
      "name": "source_id",
      "in": "query",
      "description": "Publisher sub-source (placement public id)",
      "schema": {
       "$ref": "#/components/schemas/SubSourceId"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserConversionPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/conversions/{conversion_id}/reversal": {
   "parameters": [
    {
     "$ref": "#/components/parameters/ConversionIdPath"
    }
   ],
   "post": {
    "operationId": "advertiser.reversals.create",
    "tags": [
     "advertiser"
    ],
    "summary": "Reverse conversion",
    "description": "Reverse a conversion inside its declared window, with reason code and evidence (refused after settles_at)\n\nOne conversion per call, by a person (owner, admin or finance) with a passkey sign-in from the last 12 hours (403 passkey_session_required, 403 sign_in_too_old; 403 recent_new_device for 10 minutes after one of the person's passkeys changed). An organization files at most 50 reversals a UTC day (429 reversal_daily_cap, with limit and Retry-After until the next day); its owners get a daily summary. Who, the conversion, its status and window and whether reversals are open are checked before the body, on a dry run too; a dry run changes nothing. The answer shows your own amount (your cost of the conversion) only. Evidence is plain text and is kept as you send it.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ReversalInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Reversal filed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Reversal"
        }
       }
      }
     },
     "400": {
      "description": "validation_failed: the reason, or the evidence it needs (errors name /reason_code or /evidence/<key>)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "403": {
      "description": "passkey_session_required, sign_in_too_old, recent_new_device (with retry_after_seconds) or role_not_allowed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "not_found: no such conversion in this organization",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "not_reversible (not approved, or already reversing or reversed), reversal_window_closed (the conversion is final) or reversal_money_off (reversals are not open for this conversion yet)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/reversals": {
   "get": {
    "operationId": "advertiser.reversals.list",
    "summary": "List reversals",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ReversalPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/sources/quality": {
   "get": {
    "operationId": "advertiser.sources.quality",
    "tags": [
     "advertiser"
    ],
    "summary": "Get source quality",
    "description": "Raw per-source facts. No scores.",
    "parameters": [
     {
      "name": "offer_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/OfferId"
      }
     },
     {
      "$ref": "#/components/parameters/From"
     },
     {
      "$ref": "#/components/parameters/To"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SourceQualityReport"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/source-rules": {
   "get": {
    "operationId": "advertiser.source_rules.list",
    "tags": [
     "advertiser"
    ],
    "summary": "List source rules",
    "description": "Your source rules, newest first (archived ones too); offer_id lists the rules that apply to that offer, advertiser-wide ones included.",
    "parameters": [
     {
      "name": "offer_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/OfferId"
      }
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SourceRulePage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "advertiser.source_rules.create",
    "tags": [
     "advertiser"
    ],
    "summary": "Create source rule",
    "description": "Create a rule on per-source facts (for example pause sources whose reversal rate is over a value). Compiled into a metric-layer rule; starts in shadow unless mode is live.\nOnce a day KRIN works out the rule's fact for each source (the publisher's sub_ id) of the offer, or of every offer of yours when offer_id is null, over the last 30 days, and records a decision (decisions.list, subject the offer) for each source the rule holds on. Sources with fewer credited installs than min_installs, and your own placements, are skipped. A rate counts only with at least 20 conversions behind it. A fact KRIN has no data for yet is missing, and the rule does not hold. A live pause or block rule sets the source's state on the offer (advertiser.offers.sources.set, changed by the rule): only for an allowed source, once per rule version and source, so a source you allow again stays allowed; at most 50 sources per offer a day. Shadow and notify rules only record decisions. At most 20 live source rules apply to one offer (409 source_rule_limit).",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SourceRuleInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SourceRule"
        }
       }
      }
     },
     "409": {
      "description": "source_rule_limit: 20 live source rules already apply to the offer",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/source-rules/{rule_id}": {
   "parameters": [
    {
     "name": "rule_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/RuleId"
     }
    }
   ],
   "delete": {
    "operationId": "advertiser.source_rules.archive",
    "tags": [
     "advertiser"
    ],
    "summary": "Archive source rule",
    "description": "Archive a source rule. It stops judging sources; sources it paused or blocked stay so until you allow them (advertiser.offers.sources.set).",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "Archived (archiving again answers the same)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SourceRule"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/mmp-connections": {
   "get": {
    "operationId": "advertiser.mmp.list",
    "tags": [
     "advertiser"
    ],
    "summary": "List MMP connections",
    "description": "MMP integrations (AppsFlyer, Adjust, Singular) per product and their last-event health.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data",
          "page"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/MmpConnection"
           }
          },
          "page": {
           "$ref": "#/components/schemas/PageInfo"
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "advertiser.mmp.connect",
    "summary": "Connect MMP",
    "description": "Connect an MMP to a product's app.\n\nRecords which MMP measures which app of the product. Sending the same product, MMP and app again answers 200 with the connection already there.",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MmpConnectionInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Already connected",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/MmpConnection"
        }
       }
      }
     },
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/MmpConnection"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/balance": {
   "get": {
    "operationId": "advertiser.billing.balance",
    "summary": "Get balance",
    "description": "Your own prepaid balance (while the account is a Sandbox account, its sandbox balance). committed_today_micros is the net spend of today (UTC) and runway_days divides the balance by the average daily spend of the last 7 days (null without spend).",
    "tags": [
     "advertiser"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserBalance"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/topups": {
   "get": {
    "operationId": "advertiser.billing.topups.list",
    "summary": "List top-ups",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TopupPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "advertiser.billing.topups.create",
    "tags": [
     "advertiser"
    ],
    "summary": "Create card top-up",
    "description": "Start a prepaid top-up. Card above billing.card_topup_max (default $1,000) needs completed KYB; else wire/ACH/crypto.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TopupInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created; card returns a hosted payment link, wire/ACH/crypto return instructions",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Topup"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/wire-topups": {
   "post": {
    "operationId": "advertiser.billing.wire_topups.create",
    "tags": [
     "advertiser"
    ],
    "summary": "Create wire top-up",
    "description": "Start a bank wire top-up and get KRIN's bank details with a reference to quote.\n\nOwner, admin or finance, signed in to the console with a passkey (API keys, agents and KRIN AI are refused). The checks run in this order, a dry run included: wire top-ups open (404 while they are not), the role (403), the passkey sign-in (403 passkey_session_required), a live account (409 topup_sandbox), the amount (400 at /amount_micros), KRIN's bank details in effect (409 wire_unavailable), at most 5 open (409 topup_limit). A dry run writes nothing and answers no reference and no bank details. The reference is random and new for each top-up; quote it on the transfer. KRIN credits the amount its bank receives, never more, once two KRIN people confirm the wire. Pending top-ups expire after 30 days.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WireTopupInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created, pending, with instructions",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Topup"
        }
       }
      }
     },
     "409": {
      "description": "topup_limit, wire_unavailable or topup_sandbox",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/topups/{topup_id}": {
   "parameters": [
    {
     "name": "topup_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/TopupId"
     }
    }
   ],
   "get": {
    "operationId": "advertiser.billing.topups.get",
    "tags": [
     "advertiser"
    ],
    "summary": "Get top-up",
    "description": "One top-up; a pending wire comes with KRIN's bank details and its reference.\n\nOwner, admin or finance, signed in to the console with a passkey (403 passkey_session_required). The bank details come from KRIN only and only while the wire is pending; KRIN never sends new bank details by email. Another organization's top-up answers 404.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Topup"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/topups/{topup_id}/cancel": {
   "parameters": [
    {
     "name": "topup_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/TopupId"
     }
    }
   ],
   "post": {
    "operationId": "advertiser.billing.topups.cancel",
    "tags": [
     "advertiser"
    ],
    "summary": "Cancel top-up",
    "description": "Cancel a pending wire top-up you no longer mean to send.\n\nOwner, admin or finance, signed in to the console. 409 topup_state once it is no longer pending, or while KRIN is confirming a wire for it. Another organization's top-up answers 404.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": false,
        "maxProperties": 0
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Cancelled",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Topup"
        }
       }
      }
     },
     "409": {
      "description": "topup_state",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/invoices": {
   "get": {
    "operationId": "advertiser.billing.invoices.list",
    "summary": "List invoices",
    "tags": [
     "advertiser"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/InvoicePage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/invoices/{invoice_id}/pdf": {
   "parameters": [
    {
     "name": "invoice_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/InvoiceId"
     }
    }
   ],
   "get": {
    "operationId": "advertiser.billing.invoices.pdf",
    "summary": "Download invoice PDF",
    "description": "Download one invoice as a PDF.\n\nThe file itself (Content-Disposition attachment, Cache-Control no-store), read from KRIN's private storage on each call; there is no lasting link. Another organization's invoice, or one without a PDF yet, answers 404.",
    "tags": [
     "advertiser"
    ],
    "responses": {
     "200": {
      "description": "The PDF",
      "content": {
       "application/pdf": {
        "schema": {
         "type": "string",
         "format": "binary"
        }
       }
      }
     },
     "404": {
      "description": "not_found",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "503": {
      "description": "not_configured: invoice storage is not connected here",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/recovery-credits": {
   "get": {
    "operationId": "advertiser.billing.recovery_credits.list",
    "tags": [
     "advertiser"
    ],
    "summary": "List recovery credits",
    "description": "Fraud recovery credits returned to your balance from confirmed publisher fraud, each with the affected spend and the case reference.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/From"
     },
     {
      "$ref": "#/components/parameters/To"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/RecoveryCreditPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/sources": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "get": {
    "operationId": "advertiser.offers.sources.list",
    "tags": [
     "advertiser"
    ],
    "summary": "List offer sources",
    "description": "The offer's sub-sources with a state or a multiplier (every other source is allowed at 1.00)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OfferSourceList"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "put": {
    "operationId": "advertiser.offers.sources.set",
    "tags": [
     "advertiser"
    ],
    "summary": "Set offer sources",
    "description": "Allow, pause or block publisher sub-sources for one offer (facts-driven, no grades)\nSets each listed sub-source to allowed, paused or blocked for this offer; sources not listed keep their state. A paused or blocked source no longer shows the offer and gets no new clicks on it; clicks made before keep their attribution and terms. Only sub_ ids from your own traffic on any of your offers can be named (400 on /sources/{i}/source_id otherwise). Answers the offer's paused and blocked sources after the change.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OfferSourceListInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OfferSourceList"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/offers/{offer_id}/source-multipliers": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "put": {
    "operationId": "advertiser.offers.source_multipliers.set",
    "tags": [
     "advertiser"
    ],
    "summary": "Set source bid multipliers",
    "description": "Price one offer per publisher sub-source (a multiplier from 0.25 to 2.00 on your bid)\nSets each listed sub-source's multiplier for this offer; 1.00 removes it, and sources not listed keep theirs. New clicks on that source are priced at your bid times the multiplier; clicks made before keep the terms they were made on. Anyone who may edit the offer can lower a multiplier; raising one needs an owner, admin or finance person signed in with a passkey in the last 12 hours (403 passkey_session_required, sign_in_too_old or recent_new_device; role_not_allowed for others, API keys and agents included), and the organization's owners get an email about each raise. Each source changes at most once an hour (429 source_multiplier_too_soon, with retry-after). Only sub_ ids from your own traffic can be named (400 on /sources/{i}/source_id otherwise). Until live money opens, multipliers are for sandbox accounts only (409 source_multiplier_live_off). Publishers see the resulting payout, never the multiplier. Answers the offer's sources after the change.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SourceMultiplierListInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/OfferSourceList"
        }
       }
      }
     },
     "403": {
      "description": "passkey_session_required, sign_in_too_old or recent_new_device (a raise needs a passkey sign-in from the last 12 hours) or role_not_allowed (only an owner, admin or finance person raises)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "source_multiplier_live_off: multipliers are for sandbox accounts until live money opens",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "source_multiplier_too_soon: this source changed less than an hour ago (retry-after)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/products/{product_id}/mmp-events": {
   "parameters": [
    {
     "name": "product_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/ProductId"
     }
    }
   ],
   "get": {
    "operationId": "advertiser.mmp.events.list",
    "tags": [
     "advertiser"
    ],
    "summary": "List MMP events",
    "description": "Event names seen from the product's MMP (for mapping offer milestones)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/MmpEventName"
           }
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/billing/auto-topup": {
   "put": {
    "operationId": "advertiser.billing.auto_topup.set",
    "tags": [
     "advertiser"
    ],
    "summary": "Set auto top-up",
    "description": "Auto top-up rule (threshold and amount; card amounts above the cap need KYB)",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AutoTopup"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AutoTopup"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/profile": {
   "get": {
    "operationId": "publisher.profile.get",
    "tags": [
     "publisher"
    ],
    "summary": "Get publisher profile",
    "description": "Account level (Sandbox/Starter/Approved/VIP), caps, payment terms, what unlocks next.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherProfile"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/tier-reviews": {
   "post": {
    "operationId": "publisher.tier_review.request",
    "tags": [
     "publisher"
    ],
    "summary": "Request level review",
    "description": "Ask KRIN for a level review (Starter to Approved, Approved to VIP). A person at KRIN decides.\n\nAn owner or admin signed in to the console with a passkey (403 passkey_session_required); never an API key, agent or KRIN AI. Only the next level: Starter asks for approved, Approved for vip (Sandbox moves to Starter on its own, VIP is the top); anything else is 409 tier_review_not_available. One open review per organization (409 tier_review_pending). After a rejection, the same level can be asked again once publishers.tier_review_cooldown_days have passed (409 tier_review_not_available, with available_at). The request changes nothing by itself: the level moves only when KRIN approves it.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TierReviewRequest"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Requested",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Review"
        }
       }
      }
     },
     "409": {
      "description": "A review is already open (tier_review_pending), or no review is open to this level now (tier_review_not_available)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/properties": {
   "get": {
    "operationId": "publisher.properties.list",
    "summary": "List properties",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PropertyPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "publisher.properties.create",
    "summary": "Create property",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PropertyInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Property"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/properties/{property_id}": {
   "parameters": [
    {
     "name": "property_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/PropertyId"
     }
    }
   ],
   "get": {
    "operationId": "publisher.properties.get",
    "summary": "Get property",
    "tags": [
     "publisher"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Property"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "patch": {
    "operationId": "publisher.properties.update",
    "summary": "Update property",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PropertyInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Property"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements": {
   "get": {
    "operationId": "publisher.placements.list",
    "summary": "List placements",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "property_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/PropertyId"
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/PlacementStatus"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PlacementPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "publisher.placements.create",
    "tags": [
     "publisher"
    ],
    "summary": "Create placement",
    "description": "Create a placement (offer wall, survey wall, mixed, or headless) with currency, theme and controls in one call.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PlacementInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created (status draft)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Placement"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "get": {
    "operationId": "publisher.placements.get",
    "summary": "Get placement",
    "tags": [
     "publisher"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Placement"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "patch": {
    "operationId": "publisher.placements.update",
    "tags": [
     "publisher"
    ],
    "summary": "Update placement",
    "description": "Update currency, geo multipliers, theme, controls, allowed origins, launch mode, screen-out reward, minimum age.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PlacementUpdate"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Placement"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/go-live": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "post": {
    "operationId": "publisher.placements.go_live",
    "tags": [
     "publisher"
    ],
    "summary": "Take placement live",
    "description": "testing to live. Requires an acknowledged test postback and one verified signed launch.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Placement"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_ready: `missing` lists the go_live_requirements not done (postback_acknowledged, signed_launch_verified); invalid_transition when the placement is not testing; placement_fraud_paused",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/pause": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "post": {
    "operationId": "publisher.placements.pause",
    "summary": "Pause placement",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Placement"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/resume": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "post": {
    "operationId": "publisher.placements.resume",
    "summary": "Resume placement",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Placement"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/test-wall": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "post": {
    "operationId": "publisher.placements.test_wall",
    "tags": [
     "publisher"
    ],
    "summary": "Open test wall",
    "description": "Open a test wall. A single-use link to this placement's wall for your own test user, with KRIN's test offers only. Shown once.\n\nFor an account in Sandbox. The link (wall origin + /t#token) works once, for 15 minutes. Nothing is signed with your launch secret and the session never counts as a verified signed launch. Test offers pay nothing: their rewards and postbacks are marked test. A retry with the same Idempotency-Key answers 409 test_link_already_shown: the link is never stored.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "responses": {
     "201": {
      "description": "The link (only time it is shown)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TestWallLink"
        }
       }
      }
     },
     "409": {
      "description": "sandbox_only: the account is out of Sandbox; placement_not_serving: the placement has no launch secret yet, or is paused or blocked; test_link_already_shown: an Idempotency-Key retry",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited: too many test wall links for this organization or person in the last hour (Retry-After)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/currency": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "put": {
    "operationId": "publisher.placements.currency.set",
    "tags": [
     "publisher"
    ],
    "summary": "Set placement currency",
    "description": "Set the wall currency (name, icon, amount per USD of your net, rounding). Changes what users are shown on a live wall.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/Currency"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Placement"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/theme": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "put": {
    "operationId": "publisher.placements.theme.set",
    "tags": [
     "publisher"
    ],
    "summary": "Set placement theme",
    "description": "Set the wall theme from design tokens (colors, radius, font, logo). Look only; no effect on traffic or money.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WallTheme"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Placement"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/currency-sales": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "get": {
    "operationId": "publisher.currency_sales.list",
    "summary": "List currency sales",
    "description": "The placement's sales that have not ended, then those that ended in the last 30 days, newest start first (at most 100)",
    "tags": [
     "publisher"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/CurrencySale"
           }
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "publisher.currency_sales.create",
    "tags": [
     "publisher"
    ],
    "summary": "Create currency sale",
    "description": "Schedule a reward boost (multiplier on the user reward; funded by the publisher's net)\n\nMultiplies the reward the placement shows and pays its users, in your currency, from starts_at to ends_at (in the countries listed, or everywhere). You fund it from your net: what KRIN pays you does not change. The highest sale covering a click applies; sales never stack. Rules: a multiplier above 1 and at most 10 (3 decimals); an API key, an agent or KRIN AI sets at most 3, above that a person (owner, admin or developer) signed in with a passkey; starts now or later (within 90 days), lasts at most 31 days; at most 10 sales per placement that have not ended (409 currency_sale_limit). The label is shown on the wall as plain text.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CurrencySaleInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/CurrencySale"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/currency-sales/{sale_id}": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    },
    {
     "name": "sale_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^sale_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     }
    }
   ],
   "delete": {
    "operationId": "publisher.currency_sales.cancel",
    "summary": "Cancel currency sale",
    "description": "A sale that has not started is removed; a running sale ends now (clicks made while it ran keep it). An ended sale answers 409 currency_sale_ended.",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "204": {
      "description": "Cancelled"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/integration": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "get": {
    "operationId": "publisher.integration.get",
    "tags": [
     "publisher"
    ],
    "summary": "Get integration status",
    "description": "Ready-to-paste snippets per stack, signed-launch helper, postback config, KRIN egress IPs.\n\nServer code (ts_server, php_server) and headless_api for every placement; page code (web_iframe, web_js) once the placement lists an origin that may embed it; android_sdk once the Android SDK is published. Snippets carry placeholders only: the launch key is read from the publisher's own environment (KRIN_LAUNCH_KEY), never shown here. stack picks one; a stack the placement does not get answers an empty list.",
    "parameters": [
     {
      "name": "stack",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "web_iframe",
        "web_js",
        "android_sdk",
        "headless_api",
        "php_server",
        "ts_server"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherIntegration"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/postback": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "get": {
    "operationId": "publisher.postback.get",
    "tags": [
     "publisher"
    ],
    "summary": "Get postback settings",
    "description": "The placement's reward postback config and whether its last change passed a test (404 postback_not_configured before the first PUT)\n\nA signed-in member sees the whole url_template. An API key (and an agent) gets it with the parts shaped like a secret (32 or more base64url or hex characters that are not an id) shown as ***; a shorter token is not masked, so keep secrets out of the URL or use the POST method.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackConfig"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "put": {
    "operationId": "publisher.postback.set",
    "tags": [
     "publisher"
    ],
    "summary": "Set postback settings",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "description": "Reward postback URL (https only), macros or a compatibility preset, events to send.\n\nA new URL, method or preset clears the acknowledgement: the next test postback must answer 2xx before go-live. Hosts are public names only (no IP address, no local name, no KRIN host, port 443, no macros in the host). A POST URL takes no macros: the values travel in the signed JSON body.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PostbackConfigInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackConfig"
        }
       }
      }
     },
     "422": {
      "description": "postback_template_unsigned: a GET template without every signed macro; `missing` lists them",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/postback/test": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "post": {
    "operationId": "publisher.postback.test",
    "tags": [
     "publisher"
    ],
    "summary": "Send test postback",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "description": "Send a signed test conversion or test reversal to the postback URL and return the exchange.\n\nThe message carries test: true and the placement's postback secrets sign it. A 2xx answer acknowledges the postback (a go-live requirement). A dry run answers the request it would send and sends nothing. At most postbacks.tests_per_placement_hour (30) per placement (429).",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "kind"
        ],
        "additionalProperties": false,
        "properties": {
         "kind": {
          "type": "string",
          "enum": [
           "conversion",
           "reversal"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Exchange result",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackTestResult"
        }
       }
      }
     },
     "409": {
      "description": "postback_not_configured (no URL yet) or postback_secret_missing (no postback secret yet)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/secret": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "post": {
    "operationId": "publisher.secret.rotate",
    "tags": [
     "publisher"
    ],
    "summary": "Rotate placement secret",
    "description": "Issue or rotate a placement secret (launch signs wall launches, postback signs reward postbacks). Shown once. The old one of that purpose stays valid for the grace period.\n\nThe first launch secret moves a draft placement to testing. Needs a session signed in with a passkey (403 passkey_session_required). A retry with the same Idempotency-Key answers 409 secret_already_shown: the secret is never stored in clear.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "purpose"
        ],
        "additionalProperties": false,
        "properties": {
         "purpose": {
          "type": "string",
          "enum": [
           "launch",
           "postback"
          ]
         },
         "grace_hours": {
          "type": "integer",
          "minimum": 0,
          "maximum": 168,
          "default": 24
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "New secret (only time it is shown)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SecretOnce"
        }
       }
      }
     },
     "409": {
      "description": "secret_already_shown: an Idempotency-Key retry; rotate again for a new secret",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/postback-presets": {
   "get": {
    "operationId": "publisher.postback_presets.list",
    "tags": [
     "publisher"
    ],
    "summary": "List postback presets",
    "description": "Compatibility presets that map KRIN macros to other networks' parameter names.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/PostbackPreset"
           }
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/placements/{placement_id}/demand-filters": {
   "parameters": [
    {
     "$ref": "#/components/parameters/PlacementIdPath"
    }
   ],
   "get": {
    "operationId": "publisher.demand_filters.get",
    "summary": "Get demand filters",
    "description": "The placement's own filters, plus advertiser_block_all: the advertisers blocked on every placement. 404 for a placement that is not the organization's.",
    "tags": [
     "publisher"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DemandFilters"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "put": {
    "operationId": "publisher.demand_filters.set",
    "tags": [
     "publisher"
    ],
    "summary": "Set demand filters",
    "description": "Offer types, categories, advertiser allow/block, hidden offers, pinned offers, ranking style. No grade filters.\n\nReplaces every filter of this placement with the lists sent. A list left out counts as [] (no filter of that kind). ranking_style left out stays as it is. advertiser_block_all is read-only and ignored here: blocks on every placement change only through advertiser-blocks. 400 for an advertiser both allowed and blocked, or a min_conversion_rate other than null.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/DemandFilters"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DemandFilters"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/advertiser-blocks": {
   "post": {
    "operationId": "publisher.advertiser_blocks.create",
    "tags": [
     "publisher"
    ],
    "summary": "Block advertiser",
    "description": "Hide every offer of one advertiser on all placements or one placement.\n\nBlocking twice changes nothing and answers the same. With placement_id the answer is that placement's DemandFilters (the block shows in advertiser_block); without it the answer holds advertiser_block_all only. At most 500 blocks per placement and 500 on every placement (400). 404 for a placement that is not the organization's.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AdvertiserBlockInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DemandFilters"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/advertiser-blocks/{advertiser_id}": {
   "parameters": [
    {
     "name": "advertiser_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/AdvertiserPublicId"
     }
    },
    {
     "name": "placement_id",
     "in": "query",
     "description": "The placement whose own block is lifted. Left out = the block on every placement",
     "schema": {
      "$ref": "#/components/schemas/PlacementId"
     }
    }
   ],
   "delete": {
    "operationId": "publisher.advertiser_blocks.delete",
    "tags": [
     "publisher"
    ],
    "summary": "Unblock advertiser",
    "description": "Lifts one block: with placement_id that placement's own block, without it the block on every placement (a placement's own block and the block on every placement are separate). The answer is shaped as for create. 404 when there is no such block.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DemandFilters"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/deliveries": {
   "get": {
    "operationId": "publisher.deliveries.list",
    "tags": [
     "publisher"
    ],
    "summary": "List postback deliveries",
    "description": "Integration Doctor. Every reward postback attempt with status code, latency, signature flag.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "placement_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/DeliveryStatus"
      }
     },
     {
      "$ref": "#/components/parameters/From"
     },
     {
      "$ref": "#/components/parameters/To"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DeliveryPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/deliveries/health": {
   "get": {
    "operationId": "publisher.deliveries.health",
    "summary": "Get delivery health",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "name": "placement_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     },
     {
      "$ref": "#/components/parameters/From"
     },
     {
      "$ref": "#/components/parameters/To"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DeliveryHealth"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/deliveries/replay": {
   "post": {
    "operationId": "publisher.deliveries.replay",
    "tags": [
     "publisher"
    ],
    "summary": "Replay postback deliveries",
    "description": "Replay failed deliveries by id list or time range. Each replay is a new delivery with replay_of set; the user is not paid twice if the publisher dedupes on conversion_id + event.\n\nEach replay is the same postback (same conversion, kind, amounts and test flag) with a fresh signature and timestamp, sent to the placement's current postback URL; a replay is a duplicate by design, so dedupe on conversion_id + kind. At most 1000 deliveries a call, oldest first, of the last 30 days. Skipped, not refused: ids of another organization, a delivery still being sent, a credit or hold after a later postback of the same conversion (such as its reversal), and live postbacks while live postbacks are off. 429 replay_limit when the daily caps (10 replays per postback, 100 per organization, each UTC day) leave nothing to queue.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ReplayInput"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Queued",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "queued"
         ],
         "properties": {
          "queued": {
           "type": "integer",
           "minimum": 0
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/offers": {
   "get": {
    "operationId": "publisher.offers.list",
    "tags": [
     "publisher"
    ],
    "summary": "List available offers",
    "description": "Offers available to this publisher with NET reward per event and the declared reversal window. Nothing else about economics.\n\nLive offers this publisher may earn on now, newest first: its tier, private offers it was invited to, and every event priceable now. With placement_id, only the offer types that placement shows and what its demand filters let through; 404 for a placement that is not the organization's. country and platform keep offers that target them. Caps, age gates and what one user already earned are applied per user on the wall, not here.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "placement_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     },
     {
      "name": "country",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/Country"
      }
     },
     {
      "name": "platform",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/Platform"
      }
     },
     {
      "name": "type",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/OfferType"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherOfferPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/conversions": {
   "get": {
    "operationId": "publisher.conversions.list",
    "summary": "List conversions",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "placement_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     },
     {
      "name": "offer_id",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/OfferId"
      }
     },
     {
      "name": "user_id",
      "in": "query",
      "description": "The publisher's own user id",
      "schema": {
       "type": "string",
       "maxLength": 128
      }
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/ConversionStatus"
      }
     },
     {
      "$ref": "#/components/parameters/From"
     },
     {
      "$ref": "#/components/parameters/To"
     }
    ],
    "description": "Newest first. from and to apply to when KRIN received the conversion.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherConversionPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/reversals": {
   "get": {
    "operationId": "publisher.reversals.list",
    "summary": "List reversals",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "$ref": "#/components/parameters/From"
     },
     {
      "$ref": "#/components/parameters/To"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherReversalPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/users/{user_id}": {
   "parameters": [
    {
     "name": "user_id",
     "in": "path",
     "required": true,
     "description": "The publisher's own user id (as sent in the signed launch)",
     "schema": {
      "type": "string",
      "maxLength": 128
     }
    }
   ],
   "get": {
    "operationId": "publisher.users.lookup",
    "tags": [
     "publisher"
    ],
    "summary": "Look up user",
    "description": "One end user's totals and current holds (with release time)",
    "parameters": [
     {
      "name": "placement_id",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherEndUser"
        }
       }
      }
     },
     "404": {
      "description": "user_not_found: no user with that id on this placement. A placement of another organization, an erased user and a user never seen on the placement answer the same",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "delete": {
    "operationId": "publisher.users.erase",
    "tags": [
     "publisher"
    ],
    "summary": "Erase user data",
    "description": "Erase an end user's personal data (GDPR/CCPA). Money records keep pseudonymous ids only.",
    "parameters": [
     {
      "name": "placement_id",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     },
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     }
    ],
    "responses": {
     "202": {
      "description": "Erasure queued"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/users/{user_id}/timeline": {
   "parameters": [
    {
     "name": "user_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "maxLength": 128
     }
    }
   ],
   "get": {
    "operationId": "publisher.users.timeline",
    "tags": [
     "publisher"
    ],
    "summary": "Get user timeline",
    "description": "Wall opens, clicks, events, rewards, holds, reversals and rule decisions in plain words (redacted per disclosure level)",
    "parameters": [
     {
      "name": "placement_id",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/UserTimelinePage"
        }
       }
      }
     },
     "404": {
      "description": "user_not_found: no user with that id on this placement. A placement of another organization, an erased user and a user never seen on the placement answer the same",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/users/{user_id}/status-links": {
   "parameters": [
    {
     "name": "user_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "maxLength": 128
     }
    }
   ],
   "post": {
    "operationId": "publisher.users.status_link.create",
    "tags": [
     "publisher"
    ],
    "summary": "Create user status link",
    "description": "Short-lived link the publisher's support can send the end user to see their own receipts.\nA read-only link to this user's receipts on this placement: https://wall.krin.io/status#t=.., valid for the status link lifetime set by KRIN (24 hours unless changed, never more than 7 days). The link is shown once: the same Idempotency-Key again answers 409 status_link_already_shown. A dry run answers the expiry with url null and makes no link.",
    "parameters": [
     {
      "name": "placement_id",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     },
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "url",
          "expires_at"
         ],
         "properties": {
          "url": {
           "type": "string",
           "format": "uri"
          },
          "expires_at": {
           "type": "string",
           "format": "date-time"
          }
         }
        }
       }
      }
     },
     "404": {
      "description": "user_not_found: no user with that id on this placement. A placement of another organization, an erased user and a user never seen on the placement answer the same",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "status_link_already_shown: this Idempotency-Key already made a link; make a new one",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/claims": {
   "get": {
    "operationId": "publisher.claims.list",
    "summary": "List missing-reward claims",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "status",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/ClaimStatus"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ClaimPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/payouts/balance": {
   "get": {
    "operationId": "publisher.payouts.balance",
    "tags": [
     "publisher"
    ],
    "summary": "Get earnings balance",
    "description": "Pending (inside reversal windows), available (settled), payable (on a statement), next statement and due date.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherBalance"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/payouts/statements": {
   "get": {
    "operationId": "publisher.payouts.statements.list",
    "summary": "List payout statements",
    "tags": [
     "publisher"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/StatementPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/payouts/method": {
   "get": {
    "operationId": "publisher.payout_method.get",
    "tags": [
     "publisher"
    ],
    "summary": "Get payout method",
    "description": "Current payout destination (masked) and any change in its 72-hour cooling period.",
    "responses": {
     "200": {
      "description": "OK. A JSON null body while no destination is set (a 404 means the route is not served yet)",
      "content": {
       "application/json": {
        "schema": {
         "oneOf": [
          {
           "$ref": "#/components/schemas/PayoutMethod"
          },
          {
           "type": "null"
          }
         ]
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "put": {
    "operationId": "publisher.payout_method.update",
    "tags": [
     "publisher"
    ],
    "summary": "Update payout method",
    "description": "Change payout destination. Human only, passkey sign-in, 72-hour cooling, owners and admins emailed with a stop link.\n\nOwner only, signed in to the console with a passkey in the last 12 hours (403 `passkey_session_required`, 403\n`sign_in_too_old`; 403 `recent_new_device` for 10 minutes after one of the owner's passkeys changed). The new method waits 72 hours\nbefore it becomes active; until then payments keep going to the current one. Every owner and admin gets an email\nwith a Stop button (POST /v1/payout-stop). A second change while one is waiting replaces it and the 72 hours start\nagain. The details are checked (IBAN check digits, address checksums), sealed at rest and never returned: the\nanswer shows the masked display_hint only. 404 while payout methods are not open yet. 409\n`payout_destination_held` while payouts are paused after a stopped change.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PayoutMethodInput"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Accepted; active after the cooling period",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PayoutMethod"
        }
       }
      }
     },
     "409": {
      "description": "payout_destination_held: payouts are paused after a stopped change until KRIN checks the account",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/cases": {
   "get": {
    "operationId": "publisher.cases.list",
    "tags": [
     "publisher"
    ],
    "summary": "List cases",
    "description": "Reviews of your traffic (fraud cases) with your earnings withheld, released or forfeited, newest first.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "state",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/PublisherCaseState"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherCasePage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/cases/{case_id}": {
   "parameters": [
    {
     "$ref": "#/components/parameters/CaseIdPath"
    }
   ],
   "get": {
    "operationId": "publisher.cases.get",
    "tags": [
     "publisher"
    ],
    "summary": "Get case",
    "description": "One case with its reason, scope, verdict, appeal deadline, the conversions withheld and the timeline.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherCaseDetail"
        }
       }
      }
     },
     "404": {
      "description": "case_not_found, also for another org's case",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/cases/{case_id}/appeal": {
   "parameters": [
    {
     "$ref": "#/components/parameters/CaseIdPath"
    }
   ],
   "post": {
    "operationId": "publisher.cases.appeal",
    "tags": [
     "publisher"
    ],
    "summary": "Appeal case",
    "description": "Appeal a verdict once, inside the appeal window. Human owner or admin only. A KRIN reviewer who took no part in the verdict decides, and that decision is final.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PublisherAppealInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Appeal filed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherCase"
        }
       }
      }
     },
     "409": {
      "description": "case_state: no verdict open to appeal; appeal_window_closed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/tax-forms": {
   "get": {
    "operationId": "publisher.tax_forms.list",
    "summary": "List tax forms",
    "tags": [
     "publisher"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/TaxForm"
           }
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "publisher.tax_forms.submit",
    "tags": [
     "publisher"
    ],
    "summary": "Submit tax form",
    "description": "Upload W-9 / W-8BEN / W-8BEN-E (file goes to R2 via a one-time upload URL)",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TaxFormInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TaxForm"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/sessions": {
   "post": {
    "operationId": "wall.sessions.create",
    "tags": [
     "wall"
    ],
    "summary": "Create wall session",
    "description": "Open a wall session from a signed launch (placement public id, user id, ts, nonce, HMAC-SHA256)",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SignedLaunch"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Session",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallSession"
        }
       }
      }
     },
     "401": {
      "description": "launch_rejected (signature, ts, user id or nonce) or launch_nonce_reused",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_serving: the placement is draft or paused, blocked by a fraud decision, or its org is not active",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/session": {
   "get": {
    "operationId": "wall.session.get",
    "tags": [
     "wall"
    ],
    "summary": "Get wall session",
    "description": "What the wall shows of this session (placement, first-run state), without the token.\n\nFor a wall page that got the session token another way than the session answer, such as the full-screen Android wall (the page reads the token from the URL fragment). The same facts as the 201 of wall.sessions.create minus the token. Read-only: it changes nothing, so it may be retried.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallSessionView"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_serving: the placement is paused or blocked, or its org is not active",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/test-sessions": {
   "post": {
    "operationId": "wall.test_sessions.create",
    "tags": [
     "wall"
    ],
    "summary": "Create test wall session",
    "description": "Open a test wall session from a single-use test link (the token after /t#)\n\nThe wall page posts the token from the link once. The session is for the member's own test user and lists KRIN's test offers only; placement.sandbox is true. A used, expired or unknown token answers 401 test_launch_rejected.",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TestSessionInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Session",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallSession"
        }
       }
      }
     },
     "401": {
      "description": "test_launch_rejected: the link was used, has expired or is not valid",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_serving: the placement is paused or blocked, or its org is not active",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited (Retry-After)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/profile": {
   "get": {
    "operationId": "wall.profile.get",
    "tags": [
     "wall"
    ],
    "summary": "Get wall profile",
    "description": "This user's age range and wall terms check (and the optional character), and what the wall asks next.\n\nKept on KRIN's side for this user of this app, never in the browser. The minimum age depends on where the user is now, so a user under it sees the stop screen here even after setting up elsewhere. 404 when this wall does not use the first-run steps.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallProfile"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "not_found: the wall does not use the first-run steps here",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "put": {
    "operationId": "wall.profile.update",
    "tags": [
     "wall"
    ],
    "summary": "Update wall profile",
    "description": "Save the age range and the wall terms acceptance (the one-tap check before the first start), or the optional character.\n\nSent only by the wall page on wall.krin.io, with the user's own answers: a server never sets or confirms them, so this call through api.krin.io answers 404. Send age_band and terms_version together on the first offer tap, before wall.offers.start. An age range under the minimum stops the wall for this user for good: nothing else is kept and later changes answer 409 profile_locked. Once set, the age range can only go up through the same check (a lower one answers 409 profile_locked). Only the current wall terms version is accepted (409 terms_outdated); the draft version only on a test wall or a Sandbox account's wall.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WallProfileInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallProfile"
        }
       }
      }
     },
     "400": {
      "description": "invalid_json or validation_failed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "not_found: the wall does not use the first-run steps here",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "profile_locked (stopped, or an age range lower than the one already set) or terms_outdated",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/offers": {
   "get": {
    "operationId": "wall.offers.list",
    "tags": [
     "wall"
    ],
    "summary": "List wall offers",
    "description": "Ranked offers for this session's user, rewards in the placement currency only.\n\nOpen as soon as the wall opens. Until this user's age range is known, only offers that suit the youngest user this placement allows are listed (KRIN decides on its side); more may show once the range is set. 403 onboarding_required when the wall is stopped for this user.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "parameters": [
     {
      "name": "tab",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "for_you",
        "games",
        "apps",
        "quick",
        "surveys"
       ]
      }
     },
     {
      "name": "q",
      "in": "query",
      "schema": {
       "type": "string",
       "maxLength": 80
      }
     },
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallOfferPage"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid: the wall session token is missing, forged or expired",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "403": {
      "description": "onboarding_required: the wall is stopped for this user (an age range under the minimum)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_serving: the placement is not open right now",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/offers/{offer_id}": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "get": {
    "operationId": "wall.offers.get",
    "tags": [
     "wall"
    ],
    "summary": "Get wall offer",
    "description": "Offer sheet. All milestones up front, reward each, time limits, requirements, reversal note.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallOffer"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "The offer is not open to this user",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_serving",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/offers/{offer_id}/start": {
   "parameters": [
    {
     "$ref": "#/components/parameters/OfferIdPath"
    }
   ],
   "post": {
    "operationId": "wall.offers.start",
    "tags": [
     "wall"
    ],
    "summary": "Start offer",
    "description": "Run click rules, create the click and receipt, return the t.krin.io redirect.\n\nNo click is created until this user's age range and the current wall terms are stored (wall.profile.update): before that the answer is 403 onboarding_required, which opens the one-tap check.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": false,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WallStartInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Started",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallStart"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "403": {
      "description": "onboarding_required: ask the age range and the current wall terms first; or blocked by a rule (plain reason category only)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "The offer is not open to this user",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_serving",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "click_limit (too many starts for this user) or rate_limited (per client or network); Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/impressions": {
   "post": {
    "operationId": "wall.impressions.record",
    "tags": [
     "wall"
    ],
    "summary": "Record impressions",
    "description": "Record offer tiles shown at least half in view for one second, once per offer per wall session.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WallImpressionBatch"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Recorded; accepted counts the impressions new to this session",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallImpressionResult"
        }
       }
      }
     },
     "400": {
      "description": "invalid_json or validation_failed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_serving",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "413": {
      "description": "payload_too_large",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/test-conversions": {
   "post": {
    "operationId": "wall.test_conversions.create",
    "tags": [
     "wall"
    ],
    "summary": "Create test conversion",
    "description": "Complete one step of one of KRIN's test offers from its test page.\n\nOnly for a test wall session opened from a console test link. The test page of a KRIN test offer reads click_id from its URL fragment (#click_id=..) and posts it with the step number. The conversion is a test conversion: it is decided like any other and credited in the sandbox only, and your server gets the reward postback with test=1. \"Test offer: held\" stays on hold for a few minutes before it is credited; \"Test offer: reversed\" is credited, then reversed a few minutes later. Any click_id that is not a test wall click on a KRIN test offer, a step out of order, already done or past its time limit, all answer the same 404 test_conversion_refused.",
    "security": [],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TestConversionInput"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Received; the conversion is decided shortly",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TestConversionResult"
        }
       }
      }
     },
     "400": {
      "description": "invalid_json or validation_failed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "test_conversion_refused: not a test wall click on a KRIN test offer, or this step cannot be completed now",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "413": {
      "description": "payload_too_large",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/receipts": {
   "get": {
    "operationId": "wall.receipts.list",
    "tags": [
     "wall"
    ],
    "summary": "List tracking receipts",
    "description": "My offers. Progress per started offer, milestone statuses with plain reasons and release times.\nOne receipt per offer this user started on this placement (the click with conversions, else the latest one), newest first, at most 50 a page. A paused placement still shows its users their receipts.",
    "security": [
     {
      "wallSession": []
     },
     {
      "statusLink": []
     }
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallReceiptPage"
        }
       }
      }
     },
     "400": {
      "description": "validation_failed (cursor or limit)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid: open the wall again from the app",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "403": {
      "description": "onboarding_required: the wall's first-run steps are not finished for this user",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/receipts/{click_id}": {
   "parameters": [
    {
     "name": "click_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/ClickId"
     }
    }
   ],
   "get": {
    "operationId": "wall.receipts.get",
    "summary": "Get tracking receipt",
    "description": "The receipt of one click of this user on this placement. Any other click answers 404.",
    "tags": [
     "wall"
    ],
    "security": [
     {
      "wallSession": []
     },
     {
      "statusLink": []
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallReceipt"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid: open the wall again from the app",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "403": {
      "description": "onboarding_required: the wall's first-run steps are not finished for this user",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "not_found",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/receipts/{click_id}/claims": {
   "parameters": [
    {
     "name": "click_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/ClickId"
     }
    }
   ],
   "post": {
    "operationId": "wall.claims.create",
    "tags": [
     "wall"
    ],
    "summary": "Claim missing reward",
    "security": [
     {
      "wallSession": []
     }
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "description": "Missing-reward claim. Checked automatically against tracking data first.\nOne claim per step of a click. No reward is credited on a claim: tracking data is checked first, and the advertiser answers the rest by advertiser_due_at. Asking again for the same step answers the first claim (200, created false).",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ClaimInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "This step already had a claim: that claim (created false)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallClaim"
        }
       }
      }
     },
     "201": {
      "description": "Claim filed",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallClaim"
        }
       }
      }
     },
     "400": {
      "description": "invalid_json or validation_failed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid: open the wall again from the app",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "403": {
      "description": "onboarding_required: the wall's first-run steps are not finished for this user",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "not_found (no such receipt or step)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "not_claimable, with reason step_recorded, not_opened, too_early, window_closed or daily_limit",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "413": {
      "description": "payload_too_large",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/sdk/nonces": {
   "post": {
    "operationId": "wall.sdk_nonces.create",
    "tags": [
     "wall"
    ],
    "summary": "Create SDK nonce",
    "description": "A single-use server nonce for this wall session's Android SDK.\nkey_attestation: the SDK gives the 32 decoded bytes to setAttestationChallenge on a new EC P-256 key, then sends the chain to wall.sdk_attestations.create. play_integrity: bound into Play Integrity's requestHash (sdk.md 3.2). Each nonce works once, for at most integrity.sdk_nonce_seconds and never past the wall session; at most 5 are open per session and purpose.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "purpose"
        ],
        "additionalProperties": false,
        "properties": {
         "purpose": {
          "type": "string",
          "enum": [
           "key_attestation",
           "play_integrity"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SdkNonce"
        }
       }
      }
     },
     "400": {
      "description": "invalid_json or validation_failed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "401": {
      "description": "wall_session_invalid: open the wall again from the app",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "not_found: the wall is off",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "placement_not_serving",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited, or sdk_nonce_limit (5 open nonces for this purpose); Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/sdk/attestations": {
   "post": {
    "operationId": "wall.sdk_attestations.create",
    "tags": [
     "wall"
    ],
    "summary": "Submit SDK attestation",
    "description": "Open the SDK session from the session key's Android key attestation.\nThe chain is checked by KRIN (conversion-integrity.md 6.2): Google's attestation roots, every link's signature and dates, the revocation list, the challenge (the nonce's 32 bytes), the leaf's EC P-256 key, the security level and the boot state. The attested app must be the placement's registered Android app (the property's bundle_id and android_signing_sha256): with none registered the answer is 409 sdk_app_not_registered and no SDK session opens. One SDK session per wall session and per key. Every refused chain, challenge or nonce answers the same 401 sdk_attestation_invalid. The SDK signs its telemetry batches with this key and the returned sdk_session_id.",
    "security": [
     {
      "wallSession": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SdkAttestationInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SdkSession"
        }
       }
      }
     },
     "400": {
      "description": "invalid_json or validation_failed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "401": {
      "description": "sdk_attestation_invalid (one shape for every refusal), or wall_session_invalid",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "404": {
      "description": "not_found: the wall is off",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "sdk_app_not_registered (the property has no package or signing certificate), or placement_not_serving",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "413": {
      "description": "payload_too_large (16 KB)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited; Retry-After",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "503": {
      "description": "attestation_unavailable: no current revocation list; try again later",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/wall/survey-profile": {
   "get": {
    "operationId": "wall.survey_profile.get",
    "summary": "Get survey profile",
    "tags": [
     "wall"
    ],
    "security": [
     {
      "wallSession": []
     }
    ],
    "responses": {
     "200": {
      "description": "Profiler questions and the user's answers so far",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SurveyProfile"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "put": {
    "operationId": "wall.survey_profile.save",
    "summary": "Save survey profile",
    "tags": [
     "wall"
    ],
    "security": [
     {
      "wallSession": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SurveyProfileAnswers"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SurveyProfile"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/headless/offers/query": {
   "post": {
    "operationId": "headless.offers.list",
    "tags": [
     "wall"
    ],
    "summary": "List ranked offers",
    "description": "Headless Offer API: the ranked offers of one end user, the same page the wall shows them (ranking, filters, caps, age gate, currency), for your server to draw in your own app.\n\nThe user id, IP and user agent go in the JSON body, never in the URL. Calls for the same user, placement and IP network reuse that user's headless session while it lives, so next_cursor keeps paging; a cursor works only with the key (or member) and session it came from. The end user is the wall's own: history, caps and the age range are shared with the wall. Until the user has given their age range inside the wall, the list holds the offers open to every age. A console member's call is a preview: it never counts in stats, reports or ranking. Needs a publisher secret key with offers:read, or a member (developer and up). 404 for a placement of another organization, 409 placement_not_serving, 429 rate_limited.",
    "parameters": [
     {
      "name": "placement_id",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/PlacementId"
      }
     },
     {
      "name": "country",
      "in": "query",
      "required": true,
      "description": "The end user's country. It filters the list only: the click is priced and checked on the country its browser comes from",
      "schema": {
       "$ref": "#/components/schemas/Country"
      }
     },
     {
      "name": "tab",
      "in": "query",
      "schema": {
       "type": "string",
       "enum": [
        "for_you",
        "games",
        "apps",
        "quick",
        "surveys"
       ],
       "default": "for_you"
      }
     },
     {
      "name": "cursor",
      "in": "query",
      "description": "The next_cursor of the previous page",
      "schema": {
       "type": "string",
       "pattern": "^[A-Za-z0-9_-]{22}$"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 50,
       "default": 25
      }
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/HeadlessUser"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallOfferPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/headless/offers/{offer_id}/start": {
   "parameters": [
    {
     "name": "offer_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/OfferId"
     }
    }
   ],
   "post": {
    "operationId": "headless.offers.start",
    "tags": [
     "wall"
    ],
    "summary": "Start an offer",
    "description": "Headless Offer API: one click for one offer the user tapped in your app. Send the user's browser to redirect_url (single use, on t.krin.io); the reward comes back on the placement's reward postback, as for the wall.\n\nThe browser that opens redirect_url must come from the IP network (/24 or /48) and with the user agent you sent here, or it is not redirected and nothing is credited; the mismatch counts in the placement's quality. Networks KRIN knows as data center, VPN, proxy or Tor cannot start (403 network_refused). Until the user has given their age range and accepted the wall terms inside the wall, start answers 403 onboarding_required. Needs a publisher secret key with offers:start (offers:read alone cannot start). A console member may start only on a sandbox account (test clicks). dry_run=true runs every check and answers the click_id it would make, with redirect_url null; nothing is kept. An Idempotency-Key replay answers 409 already_started (the single-use link is never stored): start again with a new key. 404 for an offer or placement this user cannot see, 409 placement_not_serving, 429 click_limit or rate_limited.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/HeadlessStartInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WallStart"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/rules": {
   "get": {
    "operationId": "rules.list",
    "tags": [
     "shared"
    ],
    "summary": "List rules",
    "description": "Rules this org owns plus KRIN baseline rules that apply to it (sensitive thresholds redacted)",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "layer",
      "in": "query",
      "schema": {
       "$ref": "#/components/schemas/RuleLayer"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/RulePage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "rules.create",
    "tags": [
     "shared"
    ],
    "summary": "Create rule",
    "description": "Create a rule (starts in shadow mode unless mode is given). Validated against rules/rule.schema.json and facts.yaml.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RuleInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Rule"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/rules/{rule_id}": {
   "parameters": [
    {
     "name": "rule_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/RuleId"
     }
    }
   ],
   "get": {
    "operationId": "rules.get",
    "summary": "Get rule",
    "tags": [
     "shared"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Rule"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "patch": {
    "operationId": "rules.update",
    "tags": [
     "shared"
    ],
    "summary": "Update rule",
    "description": "New immutable version; mode change shadow/enforce is its own audited change.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RuleInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Rule"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "delete": {
    "operationId": "rules.archive",
    "summary": "Archive rule",
    "tags": [
     "shared"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "204": {
      "description": "Archived"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/decisions": {
   "get": {
    "operationId": "decisions.list",
    "tags": [
     "shared"
    ],
    "summary": "List decisions",
    "description": "Rule decisions on this org's clicks, conversions and offers (rule, action, reason code, facts per disclosure level)\nNewest first. Your own rules show their code, name, version, mode, reason code and facts (a value for the facts listed under Decision.facts, the name of any other). Another organization's rule shows advertiser_rule or publisher_rule and the reason code you may read. KRIN's rules show krin_integrity and the reason code you may read (a concealed one as under_review, not_credited or advertiser_quality_review, named \"KRIN Conversion Integrity\"), never facts; KRIN's shadow hits and hits that changed nothing you can see are not listed.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     },
     {
      "name": "subject_id",
      "in": "query",
      "description": "A clk_, cnv_ or ofr_ id: that subject's decisions only",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "rule_id",
      "in": "query",
      "description": "One of your own rules (another organization's or KRIN's rule id matches nothing)",
      "schema": {
       "$ref": "#/components/schemas/RuleId"
      }
     },
     {
      "$ref": "#/components/parameters/From"
     },
     {
      "$ref": "#/components/parameters/To"
     },
     {
      "$ref": "#/components/parameters/DecisionSide"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DecisionPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/decisions/explain": {
   "get": {
    "operationId": "decisions.explain",
    "tags": [
     "shared"
    ],
    "summary": "Explain decision",
    "description": "Why did this click/conversion get this outcome? Plain-language chain of decisions.\nThe outcome (a conversion's status or a click's decision) and every decision you may read on it, oldest first; a conversion's chain starts with its click's decisions. Each step has the same fields as decisions.list. An id that is not one of your clicks or conversions answers 404 not_found.",
    "parameters": [
     {
      "name": "subject_id",
      "in": "query",
      "required": true,
      "description": "A clk_ or cnv_ id",
      "schema": {
       "type": "string"
      }
     },
     {
      "$ref": "#/components/parameters/DecisionSide"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DecisionExplanation"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/facts": {
   "get": {
    "operationId": "facts.list",
    "tags": [
     "shared"
    ],
    "summary": "List facts",
    "description": "Fact catalog usable in rules for this side (name, type, provenance, layer)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Fact"
           }
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/metrics": {
   "get": {
    "operationId": "metrics.catalog",
    "tags": [
     "shared"
    ],
    "summary": "List metrics",
    "description": "Metric ids, dimensions and definitions for the caller's audience",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/MetricCatalog"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/metrics/query": {
   "post": {
    "operationId": "metrics.query",
    "tags": [
     "shared"
    ],
    "summary": "Query metrics",
    "description": "The one semantic query used by tiles, charts, exports and KRIN AI. Metrics outside the audience are refused.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MetricQuery"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/MetricResult"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/saved-views": {
   "get": {
    "operationId": "saved_views.list",
    "summary": "List saved views",
    "tags": [
     "shared"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/SavedView"
           }
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "saved_views.create",
    "summary": "Create saved view",
    "tags": [
     "shared"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SavedViewInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SavedView"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/saved-views/{view_id}": {
   "parameters": [
    {
     "name": "view_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^view_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     }
    }
   ],
   "delete": {
    "operationId": "saved_views.delete",
    "summary": "Delete saved view",
    "tags": [
     "shared"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "204": {
      "description": "Deleted"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/exports": {
   "post": {
    "operationId": "exports.create",
    "tags": [
     "shared"
    ],
    "summary": "Create export",
    "description": "CSV export of a metric query or a list; delivered as a short-lived R2 link.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ExportInput"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Queued",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Export"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/exports/{export_id}": {
   "parameters": [
    {
     "name": "export_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^exp_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     }
    }
   ],
   "get": {
    "operationId": "exports.get",
    "summary": "Get export",
    "tags": [
     "shared"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Export"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/search": {
   "get": {
    "operationId": "search.query",
    "tags": [
     "shared"
    ],
    "summary": "Search everything",
    "description": "Search the caller's own organization, on the side it reads as, and the API's operations.\n\nkind entity: offers and campaigns (advertiser side), placements and properties (publisher side) whose name contains q (case-insensitive; % and _ match themselves), or the one record whose id q is (ofr_, cmp_, plc_, prop_, cnv_, rev_, and case_ on the publisher side). link is the console path inside the organization's workspace. kind action: operations of this side and shared ones whose summary contains q, with operation_id, linking to the API reference. Pages and settings are matched by the console itself. Never returns end users, email addresses or another organization's records. Best matches first: the whole name, then its start, then the start of a word.",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 120
      },
      "description": "Text or an id; no control characters"
     },
     {
      "name": "limit",
      "in": "query",
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 25,
       "default": 10
      }
     },
     {
      "$ref": "#/components/parameters/DecisionSide"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SearchResult"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/webhooks": {
   "get": {
    "operationId": "webhooks.list",
    "summary": "List webhooks",
    "description": "List the organization's webhook endpoints (an API key sees its own side's)\n\nAnswers 404 while webhooks are not available yet (features.webhooks off).",
    "tags": [
     "shared"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "data"
         ],
         "properties": {
          "data": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/WebhookEndpoint"
           }
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "webhooks.create",
    "tags": [
     "shared"
    ],
    "summary": "Create webhook",
    "description": "Subscribe an https endpoint to event types. Signing secret shown once.\n\nA person signed in with a passkey (403 passkey_session_required), so API keys cannot create endpoints. At most 10 endpoints per side (409 webhook_limit). The URL is https on port 443 with a public host name (never an IP address or a KRIN host). An organization with both sides names the side. The signing secret is in this answer only; an Idempotency-Key replay answers 409 secret_already_shown. Answers 404 while webhooks are not available yet.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WebhookEndpointInput"
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookEndpointCreated"
        }
       }
      }
     },
     "409": {
      "description": "webhook_limit (10 per side), or secret_already_shown on an Idempotency-Key replay",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/webhooks/{webhook_id}": {
   "parameters": [
    {
     "name": "webhook_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/WebhookId"
     }
    }
   ],
   "patch": {
    "operationId": "webhooks.update",
    "summary": "Update webhook",
    "description": "Change a webhook endpoint's URL, event types or status.\n\nA person signed in with a passkey (403 passkey_session_required), so API keys cannot change endpoints. Turning an endpoint on again clears its failure count.",
    "tags": [
     "shared"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WebhookEndpointPatch"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookEndpoint"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "delete": {
    "operationId": "webhooks.delete",
    "summary": "Delete webhook",
    "description": "Delete a webhook endpoint (deliveries still waiting fail as endpoint_deleted)",
    "tags": [
     "shared"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "204": {
      "description": "Deleted"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/webhooks/{webhook_id}/deliveries": {
   "parameters": [
    {
     "name": "webhook_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/WebhookId"
     }
    }
   ],
   "get": {
    "operationId": "webhooks.deliveries.list",
    "summary": "List webhook deliveries",
    "description": "List an endpoint's deliveries, newest first, each with its attempts.",
    "tags": [
     "shared"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/Cursor"
     },
     {
      "$ref": "#/components/parameters/Limit"
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/WebhookDeliveryPage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/webhooks/{webhook_id}/replay": {
   "parameters": [
    {
     "name": "webhook_id",
     "in": "path",
     "required": true,
     "schema": {
      "$ref": "#/components/schemas/WebhookId"
     }
    }
   ],
   "post": {
    "operationId": "webhooks.replay",
    "summary": "Replay webhook events",
    "description": "Send delivered or failed deliveries again, to the endpoint's current URL.\n\nAt most 1000 deliveries a call, of events up to 30 days old; never one being sent right now. The attempt count carries on. 409 webhook_disabled while the endpoint is off.",
    "tags": [
     "shared"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKeyRequired"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WebhookReplayInput"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Queued",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "queued"
         ],
         "properties": {
          "queued": {
           "type": "integer",
           "minimum": 0
          }
         }
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/advertiser/sandbox": {
   "post": {
    "operationId": "advertiser.sandbox.provision",
    "tags": [
     "advertiser"
    ],
    "summary": "Create advertiser sandbox",
    "description": "Create the advertiser sandbox kit (test product, campaign and offer; sandbox keys shown once)",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AdvertiserSandboxKit"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/publisher/sandbox": {
   "post": {
    "operationId": "publisher.sandbox.provision",
    "tags": [
     "publisher"
    ],
    "summary": "Create publisher sandbox",
    "description": "Create the publisher sandbox kit (test property and placement with test offers; sandbox keys shown once)",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "responses": {
     "201": {
      "description": "Created",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PublisherSandboxKit"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/sandbox/events": {
   "post": {
    "operationId": "sandbox.fire_test",
    "tags": [
     "shared"
    ],
    "summary": "Fire test event",
    "description": "Fire a test click, conversion or reversal through the full sandbox chain (no real money)\n\nFor an account in sandbox, through one of its own placements that is testing or live. KRIN records a test click on one of its test offers for a new test user it makes (you never name a user), and for conversion, hold and reversal a test conversion that KRIN decides like any other, in the sandbox only. Your server gets the reward postback with test=1 once it is credited (and a reverse one for reversal). At most 20 a placement an hour. 404 while the test wall is off.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     },
     {
      "$ref": "#/components/parameters/DryRun"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SandboxEventInput"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Fired",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/SandboxEventResult"
        }
       }
      }
     },
     "403": {
      "description": "side_not_enabled: the organization has no publisher side; role_not_allowed",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "409": {
      "description": "sandbox_only: the account is out of sandbox; placement_not_serving: the placement is draft, paused or blocked",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited (Retry-After): at most 20 a placement an hour, and a daily cap for the organization; detail names the one reached",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/ai/conversations": {
   "post": {
    "operationId": "ai.conversations.create",
    "tags": [
     "shared"
    ],
    "summary": "Start AI conversation",
    "description": "Talk to KRIN AI. Streams (SSE). Tool calls go through this API under the member's role and the org's agent policy.",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AiMessageInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "SSE stream of AiEvent",
      "content": {
       "text/event-stream": {
        "schema": {
         "$ref": "#/components/schemas/AiEvent"
        }
       }
      }
     },
     "429": {
      "description": "Org AI cap reached (ai_cap_reached)",
      "content": {
       "application/problem+json": {
        "schema": {
         "$ref": "#/components/schemas/Problem"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/ai/conversations/{conversation_id}/messages": {
   "parameters": [
    {
     "name": "conversation_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^chat_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     }
    }
   ],
   "post": {
    "operationId": "ai.conversations.reply",
    "summary": "Reply to AI conversation",
    "tags": [
     "shared"
    ],
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AiMessageInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "SSE stream of AiEvent",
      "content": {
       "text/event-stream": {
        "schema": {
         "$ref": "#/components/schemas/AiEvent"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/ai/confirmations/{confirmation_id}": {
   "parameters": [
    {
     "name": "confirmation_id",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "pattern": "^cfm_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     }
    }
   ],
   "get": {
    "operationId": "ai.confirmations.get",
    "tags": [
     "shared"
    ],
    "summary": "Get AI confirmation",
    "description": "Status of an action waiting for a human tap. After approval, call the same tool again with confirmation_id.",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Confirmation"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "post": {
    "operationId": "ai.confirmations.decide",
    "tags": [
     "shared"
    ],
    "summary": "Decide AI confirmation",
    "description": "A human approves or declines an action card proposed by KRIN AI or an MCP agent. Never callable by agents.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "decision"
        ],
        "additionalProperties": false,
        "properties": {
         "decision": {
          "type": "string",
          "enum": [
           "approve",
           "decline"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Result of the confirmed operation or the decline",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Confirmation"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/ai/usage": {
   "get": {
    "operationId": "ai.usage.get",
    "tags": [
     "shared"
    ],
    "summary": "Get AI usage",
    "description": "This org's KRIN AI usage against its caps, in tokens (cost stays internal)",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AiUsage"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/docs/search": {
   "get": {
    "operationId": "docs.search",
    "tags": [
     "shared"
    ],
    "summary": "Search docs",
    "description": "Search docs.krin.io (guides, reference, reason codes); public, also an MCP tool.",
    "security": [
     {},
     {
      "apiKey": []
     }
    ],
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "minLength": 1,
       "maxLength": 200
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DocsSearchResult"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/org/kyb": {
   "get": {
    "operationId": "org.kyb.get",
    "summary": "Get business verification",
    "tags": [
     "org"
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Kyb"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   },
   "put": {
    "operationId": "org.kyb.submit",
    "tags": [
     "org"
    ],
    "summary": "Submit business verification",
    "description": "Company details and document references for KYB (needed above the money thresholds)",
    "parameters": [
     {
      "$ref": "#/components/parameters/IdempotencyKey"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/KybInput"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Submitted",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Kyb"
        }
       }
      }
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/v1/meetings": {
   "post": {
    "operationId": "meetings.request",
    "tags": [
     "org"
    ],
    "summary": "Request meeting",
    "description": "White-glove track. Ask for a meeting slot; opens a request with the KRIN team.",
    "security": [
     {},
     {
      "session": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MeetingRequest"
       }
      }
     }
    },
    "responses": {
     "202": {
      "description": "Requested"
     },
     "default": {
      "$ref": "#/components/responses/Problem"
     }
    }
   }
  },
  "/c/{click_token}": {
   "parameters": [
    {
     "name": "click_token",
     "in": "path",
     "required": true,
     "description": "Signed, single-use click token from wall.offers.start",
     "schema": {
      "type": "string",
      "maxLength": 512
     }
    }
   ],
   "get": {
    "operationId": "tracking.click.redirect",
    "tags": [
     "tracking"
    ],
    "summary": "Follow tracking link",
    "description": "302 to the advertiser tracking URL with KRIN macros filled (click id, sub-source = placement public id)",
    "security": [],
    "servers": [
     {
      "url": "https://t.krin.io"
     }
    ],
    "responses": {
     "302": {
      "description": "Redirect",
      "headers": {
       "Location": {
        "schema": {
         "type": "string",
         "format": "uri"
        }
       }
      }
     },
     "404": {
      "description": "The token is forged, or tracking is switched off for this host"
     },
     "410": {
      "description": "Token used or expired"
     },
     "429": {
      "description": "Too many clicks from this client or network; Retry-After"
     },
     "503": {
      "description": "not_configured: tracking keys or the database are not bound yet"
     }
    }
   }
  },
  "/pb/{offer_key}": {
   "parameters": [
    {
     "name": "offer_key",
     "in": "path",
     "required": true,
     "description": "Per-offer inbound key (not a secret by itself)",
     "schema": {
      "type": "string",
      "maxLength": 64
     }
    }
   ],
   "get": {
    "operationId": "tracking.postback.s2s",
    "tags": [
     "tracking"
    ],
    "summary": "Receive S2S postback",
    "description": "Generic S2S conversion postback from the advertiser or source, signed with the offer's inbound secret. An IP allowlist only adds to the signature (hmac_and_ip); alone it verifies nothing. On s2s.krin.io a verified client certificate is required too. GET only.",
    "security": [],
    "servers": [
     {
      "url": "https://t.krin.io"
     },
     {
      "url": "https://s2s.krin.io",
      "description": "mTLS (client certificate required)"
     }
    ],
    "parameters": [
     {
      "name": "click_id",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/ClickToken"
      }
     },
     {
      "name": "event",
      "in": "query",
      "required": true,
      "description": "Declared event key",
      "schema": {
       "type": "string",
       "maxLength": 64
      }
     },
     {
      "name": "txn_id",
      "in": "query",
      "description": "Upstream transaction id (dedup)",
      "schema": {
       "type": "string",
       "maxLength": 128
      }
     },
     {
      "name": "revenue",
      "in": "query",
      "description": "Optional upstream revenue (stored control-only)",
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "ts",
      "in": "query",
      "required": true,
      "description": "Unix seconds; within 900 s of KRIN's clock",
      "schema": {
       "type": "integer"
      }
     },
     {
      "name": "sig",
      "in": "query",
      "required": true,
      "description": "hex(HMAC-SHA256(inbound secret, \"krin-in-v2\\nGET\\n{host}\\n{path}\\n{raw query without the sig pair}\"))",
      "schema": {
       "type": "string",
       "pattern": "^[0-9a-f]{64}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "accepted (with conversion_id) or duplicate",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackAnswer"
        }
       }
      }
     },
     "400": {
      "description": "pb_bad_parameter (encoding, control characters, shape) or pb_duplicate_parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "401": {
      "description": "pb_unauthenticated: every authentication failure answers the same",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "404": {
      "description": "pb_unknown_click (bad MAC, unknown click, or a click of another offer); not_found while features.postbacks is off",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "405": {
      "description": "Any method but GET (no body)"
     },
     "414": {
      "description": "A query over 4 KB",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "422": {
      "description": "pb_undeclared_event, pb_app_mismatch or pb_bad_timestamp",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited",
      "headers": {
       "Retry-After": {
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "503": {
      "description": "not_configured or unavailable (with Retry-After); retry later",
      "headers": {
       "Retry-After": {
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     }
    }
   }
  },
  "/mmp/{mmp}": {
   "parameters": [
    {
     "name": "mmp",
     "in": "path",
     "required": true,
     "schema": {
      "type": "string",
      "enum": [
       "appsflyer",
       "adjust",
       "singular"
      ]
     }
    }
   ],
   "get": {
    "operationId": "tracking.postback.mmp",
    "tags": [
     "tracking"
    ],
    "summary": "Receive MMP postback",
    "description": "MMP partner postback receiver (installs, in-app events, rejected/blocked callbacks). Authentic only with all four: connecting IP in the MMP's live published ranges, the per-tracker MMP key (`k`), a click token bound to the offer, and the offer's app id. GET only: other methods answer 405.",
    "security": [],
    "servers": [
     {
      "url": "https://t.krin.io"
     },
     {
      "url": "https://s2s.krin.io",
      "description": "mTLS (client certificate required)"
     }
    ],
    "responses": {
     "200": {
      "description": "accepted (with conversion_id), duplicate, or ignored when the MMP says the install is not KRIN's (MMP-19: nothing recorded, do not retry)",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackAnswer"
        }
       }
      }
     },
     "400": {
      "description": "pb_duplicate_parameter (a parameter twice, or one outside the template) or pb_bad_parameter",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "401": {
      "description": "pb_unauthenticated: outside the ranges, missing or wrong MMP key, or a tracker not on mmp_ip_range",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "404": {
      "description": "pb_unknown_click (bad MAC, unknown click, or a click of another offer or receiver); not_found while features.postbacks is off",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "405": {
      "description": "Any method but GET (no body)"
     },
     "414": {
      "description": "A query over 4 KB",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "422": {
      "description": "pb_app_mismatch, pb_undeclared_event or pb_bad_timestamp",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "429": {
      "description": "rate_limited",
      "headers": {
       "Retry-After": {
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     },
     "503": {
      "description": "not_configured or unavailable (with Retry-After); retry later",
      "headers": {
       "Retry-After": {
        "schema": {
         "type": "integer"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/PostbackError"
        }
       }
      }
     }
    }
   }
  }
 },
 "webhooks": {
  "publisher.reward": {
   "post": {
    "operationId": "hook.publisher.reward",
    "summary": "Reward postback",
    "description": "Reward postback to the publisher's server (also available as a GET URL template with macros).\n\nSigned with the placement secret: header `X-Krin-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, \"<t>.<raw body>\")>`.\nDedupe on `conversion_id` + `kind`. Amounts are the publisher's NET only.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RewardPostback"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Acknowledged. Anything else is retried for 72 h, then replayable."
     }
    }
   }
  },
  "publisher.event": {
   "post": {
    "operationId": "hook.publisher.event",
    "summary": "Publisher webhook events",
    "description": "Publisher webhook events (conversion.held, conversion.reversed, statement.issued, payout.sent, placement.paused, tier.changed).",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PublisherWebhookEvent"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Acknowledged"
     }
    }
   }
  },
  "advertiser.event": {
   "post": {
    "operationId": "hook.advertiser.event",
    "summary": "Advertiser webhook events",
    "description": "Advertiser webhook events (offer.status_changed, offer.checks_completed, conversion.approved, balance.low, topup.succeeded, reversal.completed).",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AdvertiserWebhookEvent"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Acknowledged"
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "apiKey": {
    "type": "http",
    "scheme": "bearer",
    "description": "Secret API key `krin_sk_(live|test)_` and 40 letters and digits, scoped to one org and one side. Stored as HMAC with a server pepper. One 401 `invalid_api_key` for a missing, unknown, revoked or expired key. 403 `ip_not_allowed` outside the key's allowlist, `scope_missing` without the operation's scope (a write scope also covers its reads), `side_not_enabled` for the other side's operations, `not_for_api_keys` for operations a person runs in the console, `test_key_live_account` for a test key once the organization is live."
   },
   "oauth2": {
    "type": "oauth2",
    "description": "OAuth 2.1 with PKCE. Issuer https://app.krin.io. Every token is bound to one org, one side and one resource (RFC 8707): https://mcp.krin.io/mcp or https://api.krin.io. Each operation lists its scope; x:write implies x:read; human-only scopes are never granted to agents.",
    "flows": {
     "authorizationCode": {
      "authorizationUrl": "https://app.krin.io/oauth/authorize",
      "tokenUrl": "https://app.krin.io/oauth/token",
      "refreshUrl": "https://app.krin.io/oauth/token",
      "scopes": {
       "org:read": "Read the organization, members and settings",
       "org:write": "Change organization profile",
       "org:admin": "Members and keys (human only)",
       "offers:read": "Read offers and campaigns",
       "offers:write": "Create and change offers",
       "placements:read": "Read placements",
       "placements:write": "Create and change placements",
       "conversions:read": "Read conversions and reversals",
       "conversions:write": "File reversals",
       "deliveries:read": "Read reward deliveries",
       "deliveries:write": "Replay deliveries",
       "users:read": "Look up end users",
       "users:write": "Erase end users (human only)",
       "payouts:read": "Read balances and statements",
       "payouts:write": "Payout method and tax forms (human only)",
       "billing:read": "Read balance, top-ups and invoices",
       "billing:write": "Start top-ups",
       "reports:read": "Metrics, reports and exports",
       "rules:read": "Read rules and decisions",
       "rules:write": "Create and change rules",
       "webhooks:read": "Read webhooks",
       "webhooks:write": "Change webhooks",
       "secrets:write": "Rotate secrets (human only)",
       "sandbox:write": "Fire sandbox events",
       "ai:use": "Use KRIN AI"
      }
     }
    }
   },
   "session": {
    "type": "apiKey",
    "in": "cookie",
    "name": "__Host-krin_session",
    "description": "Console session on app.krin.io only (email code or passkey; operations marked passkey_session need a passkey sign-in). Host-only cookie, never sent to api.krin.io. Org-scoped calls name the org in the Krin-Org header."
   },
   "wallSession": {
    "type": "http",
    "scheme": "bearer",
    "description": "Short-lived wall session token from wall.sessions.create."
   },
   "statusLink": {
    "type": "apiKey",
    "in": "header",
    "name": "Krin-Status-Link",
    "description": "Signed end-user status link from publisher.users.status_link.create. The link carries it in the URL fragment (https://wall.krin.io/status#t=..), so it never reaches a request log or a Referer; the status page sends it in this header. Read-only: accepted by wall.receipts.list and wall.receipts.get only, never as a wall session."
   }
  },
  "parameters": {
   "Cursor": {
    "name": "cursor",
    "in": "query",
    "description": "Opaque cursor from the previous page",
    "schema": {
     "type": "string",
     "maxLength": 512
    }
   },
   "Limit": {
    "name": "limit",
    "in": "query",
    "schema": {
     "type": "integer",
     "minimum": 1,
     "maximum": 100,
     "default": 25
    }
   },
   "From": {
    "name": "from",
    "in": "query",
    "description": "Inclusive start (UTC)",
    "schema": {
     "type": "string",
     "format": "date-time"
    }
   },
   "To": {
    "name": "to",
    "in": "query",
    "description": "Exclusive end (UTC)",
    "schema": {
     "type": "string",
     "format": "date-time"
    }
   },
   "IdempotencyKey": {
    "name": "Idempotency-Key",
    "in": "header",
    "description": "Same key + same body returns the first result for 24 h",
    "schema": {
     "type": "string",
     "minLength": 8,
     "maxLength": 128
    }
   },
   "IdempotencyKeyRequired": {
    "name": "Idempotency-Key",
    "in": "header",
    "required": true,
    "description": "Required on money-moving and security writes",
    "schema": {
     "type": "string",
     "minLength": 8,
     "maxLength": 128
    }
   },
   "DryRun": {
    "name": "dry_run",
    "in": "query",
    "description": "Validate and return the would-be result and a diff without applying",
    "schema": {
     "type": "boolean",
     "default": false
    }
   },
   "OfferIdPath": {
    "name": "offer_id",
    "in": "path",
    "required": true,
    "schema": {
     "$ref": "#/components/schemas/OfferId"
    }
   },
   "ConversionIdPath": {
    "name": "conversion_id",
    "in": "path",
    "required": true,
    "schema": {
     "$ref": "#/components/schemas/ConversionId"
    }
   },
   "PlacementIdPath": {
    "name": "placement_id",
    "in": "path",
    "required": true,
    "schema": {
     "$ref": "#/components/schemas/PlacementId"
    }
   },
   "CaseIdPath": {
    "name": "case_id",
    "in": "path",
    "required": true,
    "schema": {
     "$ref": "#/components/schemas/CaseId"
    }
   },
   "DecisionSide": {
    "name": "side",
    "in": "query",
    "description": "The side to read as, for an organization with both (publisher when not given)",
    "schema": {
     "$ref": "#/components/schemas/Side"
    }
   }
  },
  "responses": {
   "Problem": {
    "description": "Error (RFC 9457)",
    "content": {
     "application/problem+json": {
      "schema": {
       "$ref": "#/components/schemas/Problem"
      }
     }
    }
   }
  },
  "schemas": {
   "Micros": {
    "type": "integer",
    "format": "int64",
    "description": "Integer micro-USD (1 USD = 1,000,000)"
   },
   "MicrosNonNeg": {
    "type": "integer",
    "format": "int64",
    "minimum": 0
   },
   "Country": {
    "type": "string",
    "pattern": "^[A-Z]{2}$",
    "description": "ISO 3166-1 alpha-2"
   },
   "Platform": {
    "type": "string",
    "enum": [
     "android",
     "ios",
     "web",
     "windows",
     "macos"
    ]
   },
   "Side": {
    "type": "string",
    "enum": [
     "advertiser",
     "publisher"
    ]
   },
   "ActorType": {
    "type": "string",
    "enum": [
     "member",
     "api_key",
     "agent",
     "krin_ai",
     "rule",
     "system",
     "control",
     "end_user",
     "mmp"
    ],
    "description": "API view of the DB actor types: control_member is shown as control, demand_source as system (a tenant never learns a demand source acted)"
   },
   "Role": {
    "type": "string",
    "enum": [
     "owner",
     "admin",
     "developer",
     "finance",
     "analyst",
     "support"
    ]
   },
   "Timestamp": {
    "type": "string",
    "format": "date-time"
   },
   "DecimalString": {
    "type": "string",
    "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
    "description": "Exact decimal as a string"
   },
   "OrgId": {
    "type": "string",
    "pattern": "^org_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "MemberId": {
    "type": "string",
    "pattern": "^mem_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "UserId": {
    "type": "string",
    "pattern": "^usr_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "PasskeyId": {
    "type": "string",
    "pattern": "^pkey_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "Locale": {
    "type": "string",
    "enum": [
     "en",
     "de",
     "fr",
     "es",
     "pt-BR",
     "ja",
     "ko",
     "zh-CN",
     "it",
     "tr"
    ],
    "description": "The 10 KRIN languages"
   },
   "ProductId": {
    "type": "string",
    "pattern": "^prd_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "CampaignId": {
    "type": "string",
    "pattern": "^cmp_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "OfferId": {
    "type": "string",
    "pattern": "^ofr_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "OfferEventId": {
    "type": "string",
    "pattern": "^evt_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "PropertyId": {
    "type": "string",
    "pattern": "^prop_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "PlacementId": {
    "type": "string",
    "pattern": "^plc_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "ClickId": {
    "type": "string",
    "pattern": "^clk_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "InvoiceId": {
    "type": "string",
    "pattern": "^inv_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "TopupId": {
    "type": "string",
    "pattern": "^top_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "ClaimId": {
    "type": "string",
    "pattern": "^clm_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "ConversionId": {
    "type": "string",
    "pattern": "^cnv_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "RuleId": {
    "type": "string",
    "pattern": "^rul_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "WebhookId": {
    "type": "string",
    "pattern": "^whk_[0-7][0-9a-hjkmnp-tv-z]{25}$"
   },
   "SubSourceId": {
    "type": "string",
    "pattern": "^sub_[0-7][0-9a-hjkmnp-tv-z]{25}$",
    "description": "Placement public id: the sub-source advertisers see. Random and stable; never reveals the publisher"
   },
   "ClickToken": {
    "type": "string",
    "pattern": "^clk_[0-9a-hjkmnp-tv-z][0-7][0-9a-hjkmnp-tv-z]{25}[0-7][0-9a-hjkmnp-tv-z]{25}$",
    "description": "Click id as it travels in tracking URLs and inbound postbacks: kid + click TypeID suffix + 128-bit MAC. The API shows the 26-char ClickId."
   },
   "PageInfo": {
    "type": "object",
    "required": [
     "next_cursor"
    ],
    "properties": {
     "next_cursor": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "Problem": {
    "type": "object",
    "required": [
     "type",
     "title",
     "status",
     "code"
    ],
    "properties": {
     "type": {
      "type": "string",
      "format": "uri"
     },
     "title": {
      "type": "string"
     },
     "status": {
      "type": "integer"
     },
     "code": {
      "type": "string",
      "description": "Stable error code"
     },
     "detail": {
      "type": "string"
     },
     "request_id": {
      "type": "string"
     },
     "errors": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "path": {
         "type": "string"
        },
        "message": {
         "type": "string"
        }
       }
      }
     }
    }
   },
   "ActorRef": {
    "type": "object",
    "required": [
     "type"
    ],
    "description": "Who did it (shown on every write in the console)",
    "properties": {
     "type": {
      "$ref": "#/components/schemas/ActorType"
     },
     "id": {
      "type": [
       "string",
       "null"
      ]
     },
     "label": {
      "type": "string",
      "description": "e.g. \"KRIN AI on behalf of Dana\", \"API key ci-deploy\". On publisher routes ActorRef carries type only, never id or label: the actor is the advertiser's or KRIN's"
     }
    }
   },
   "DryRunDiff": {
    "type": "object",
    "properties": {
     "dry_run": {
      "type": "boolean"
     },
     "result": {
      "description": "The resource as the call would leave it (nothing was written)"
     },
     "diff": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "path": {
         "type": "string"
        },
        "from": {},
        "to": {}
       }
      }
     }
    }
   },
   "OrgCreate": {
    "type": "object",
    "required": [
     "name",
     "sides",
     "accept_terms",
     "terms_version"
    ],
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
     },
     "website": {
      "type": "string",
      "format": "uri"
     },
     "country": {
      "$ref": "#/components/schemas/Country"
     },
     "sides": {
      "type": "array",
      "minItems": 1,
      "uniqueItems": true,
      "items": {
       "$ref": "#/components/schemas/Side"
      }
     },
     "advertiser_track": {
      "type": "string",
      "enum": [
       "self_serve",
       "enterprise"
      ]
     },
     "accept_terms": {
      "type": "boolean",
      "const": true,
      "description": "The KRIN terms (and for publishers the promotion rules) are accepted"
     },
     "terms_version": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
      "description": "Version date of the terms the person was shown and accepted (krin.io/legal/terms), e.g. 2026-12-05"
     }
    }
   },
   "Organization": {
    "type": "object",
    "required": [
     "id",
     "name",
     "sides",
     "kyb_status",
     "status",
     "mode"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/OrgId"
     },
     "name": {
      "type": "string"
     },
     "legal_name": {
      "type": [
       "string",
       "null"
      ]
     },
     "country": {
      "type": [
       "string",
       "null"
      ]
     },
     "website": {
      "type": [
       "string",
       "null"
      ]
     },
     "sides": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Side"
      }
     },
     "kyb_status": {
      "type": "string",
      "enum": [
       "not_started",
       "pending",
       "verified",
       "rejected"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "suspended",
       "closed"
      ]
     },
     "mode": {
      "type": "string",
      "enum": [
       "sandbox",
       "live"
      ]
     },
     "advertiser": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "track": {
        "type": "string",
        "enum": [
         "self_serve",
         "enterprise"
        ]
       },
       "onboarding": {
        "type": "string",
        "enum": [
         "sandbox",
         "pilot",
         "active",
         "suspended"
        ]
       }
      }
     },
     "publisher": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "$ref": "#/components/schemas/PublisherProfile"
       }
      ]
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "OrganizationUpdate": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
     },
     "legal_name": {
      "type": "string",
      "maxLength": 200
     },
     "country": {
      "$ref": "#/components/schemas/Country"
     },
     "website": {
      "type": "string",
      "format": "uri"
     }
    }
   },
   "Me": {
    "type": "object",
    "required": [
     "user",
     "memberships"
    ],
    "properties": {
     "user": {
      "type": "object",
      "required": [
       "id",
       "email"
      ],
      "properties": {
       "id": {
        "$ref": "#/components/schemas/UserId"
       },
       "email": {
        "type": "string",
        "format": "email"
       },
       "name": {
        "type": "string"
       }
      }
     },
     "memberships": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "org",
        "member_id",
        "role",
        "sides"
       ],
       "properties": {
        "org": {
         "$ref": "#/components/schemas/Organization"
        },
        "member_id": {
         "$ref": "#/components/schemas/MemberId"
        },
        "role": {
         "$ref": "#/components/schemas/Role"
        },
        "sides": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Side"
         }
        }
       }
      }
     },
     "sign_in_method": {
      "type": "string",
      "enum": [
       "email_code",
       "passkey"
      ],
      "description": "How this session signed in. Operations marked passkey_session need a passkey sign-in."
     },
     "has_passkey": {
      "type": "boolean",
      "description": "This person has a passkey (offer \"Sign in with your passkey\"; otherwise \"Add a passkey\")"
     }
    }
   },
   "AuthEmailStart": {
    "type": "object",
    "required": [
     "email",
     "turnstile_token"
    ],
    "additionalProperties": false,
    "properties": {
     "email": {
      "type": "string",
      "format": "email",
      "maxLength": 254,
      "description": "Lower-cased and trimmed by the server"
     },
     "turnstile_token": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
     },
     "locale": {
      "$ref": "#/components/schemas/Locale"
     },
     "intent": {
      "type": "string",
      "enum": [
       "sign_up",
       "sign_in"
      ],
      "description": "Email wording only; the flow is the same"
     }
    }
   },
   "AuthEmailStarted": {
    "type": "object",
    "required": [
     "resend_after_seconds"
    ],
    "properties": {
     "resend_after_seconds": {
      "type": "integer",
      "minimum": 0,
      "description": "The console waits this long before offering a new code"
     }
    }
   },
   "AuthEmailVerify": {
    "type": "object",
    "required": [
     "email",
     "code"
    ],
    "additionalProperties": false,
    "properties": {
     "email": {
      "type": "string",
      "format": "email",
      "maxLength": 254
     },
     "code": {
      "type": "string",
      "pattern": "^[0-9]{6}$"
     }
    }
   },
   "AuthCodeProblem": {
    "allOf": [
     {
      "$ref": "#/components/schemas/Problem"
     },
     {
      "type": "object",
      "properties": {
       "code": {
        "type": "string",
        "enum": [
         "code_wrong",
         "code_locked",
         "code_expired",
         "validation_failed"
        ]
       },
       "attempts_left": {
        "type": "integer",
        "minimum": 0,
        "maximum": 4
       }
      }
     }
    ]
   },
   "SignOut": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "all": {
      "type": "boolean",
      "default": false,
      "description": "End every session of this person"
     }
    }
   },
   "WebAuthnOptions": {
    "type": "object",
    "required": [
     "public_key"
    ],
    "properties": {
     "public_key": {
      "type": "object",
      "additionalProperties": true,
      "description": "W3C WebAuthn L3 PublicKeyCredentialCreationOptionsJSON or PublicKeyCredentialRequestOptionsJSON (camelCase, base64url)"
     }
    }
   },
   "WebAuthnCredential": {
    "type": "object",
    "additionalProperties": true,
    "required": [
     "id",
     "rawId",
     "type",
     "response"
    ],
    "description": "PublicKeyCredential.toJSON: RegistrationResponseJSON or AuthenticationResponseJSON (base64url fields)",
    "properties": {
     "id": {
      "type": "string",
      "maxLength": 1400
     },
     "rawId": {
      "type": "string",
      "maxLength": 1400
     },
     "type": {
      "type": "string",
      "enum": [
       "public-key"
      ]
     },
     "response": {
      "type": "object",
      "additionalProperties": true
     }
    }
   },
   "PasskeyCreate": {
    "type": "object",
    "required": [
     "credential"
    ],
    "additionalProperties": false,
    "properties": {
     "credential": {
      "$ref": "#/components/schemas/WebAuthnCredential"
     },
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 60,
      "description": "Shown in the list and in the security email (default Passkey)"
     },
     "locale": {
      "$ref": "#/components/schemas/Locale"
     }
    }
   },
   "Passkey": {
    "type": "object",
    "required": [
     "id",
     "name",
     "backed_up",
     "transports",
     "created_at"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/PasskeyId"
     },
     "name": {
      "type": "string"
     },
     "backed_up": {
      "type": "boolean",
      "description": "Synced to a passkey provider (iCloud Keychain, Google Password Manager and the like)"
     },
     "transports": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "usb",
        "nfc",
        "ble",
        "internal",
        "hybrid",
        "smart-card",
        "cable"
       ]
      }
     },
     "created_at": {
      "type": "string",
      "format": "date-time"
     },
     "last_used_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "PasskeyList": {
    "type": "object",
    "required": [
     "data",
     "signed_in_with_passkey",
     "first_passkey_until"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Passkey"
      }
     },
     "signed_in_with_passkey": {
      "type": "boolean",
      "description": "This session signed in with a passkey: it may add another passkey or remove one"
     },
     "first_passkey_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "With no passkey yet: until when this session may add the first one"
     }
    }
   },
   "PasskeySignInStart": {
    "type": "object",
    "required": [
     "turnstile_token"
    ],
    "additionalProperties": false,
    "properties": {
     "turnstile_token": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2048
     }
    }
   },
   "PasskeySignIn": {
    "type": "object",
    "required": [
     "credential"
    ],
    "additionalProperties": false,
    "properties": {
     "credential": {
      "$ref": "#/components/schemas/WebAuthnCredential"
     }
    }
   },
   "Member": {
    "type": "object",
    "required": [
     "id",
     "email",
     "role",
     "sides",
     "status"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/MemberId"
     },
     "email": {
      "type": "string",
      "format": "email"
     },
     "role": {
      "$ref": "#/components/schemas/Role"
     },
     "sides": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Side"
      }
     },
     "status": {
      "type": "string",
      "enum": [
       "invited",
       "active",
       "removed"
      ]
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "MemberPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Member"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "MemberInvite": {
    "type": "object",
    "required": [
     "email",
     "role"
    ],
    "additionalProperties": false,
    "properties": {
     "email": {
      "type": "string",
      "format": "email"
     },
     "role": {
      "$ref": "#/components/schemas/Role"
     },
     "sides": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Side"
      }
     }
    }
   },
   "MemberUpdate": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "role": {
      "$ref": "#/components/schemas/Role"
     },
     "sides": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Side"
      }
     }
    }
   },
   "ApiKey": {
    "type": "object",
    "required": [
     "id",
     "side",
     "name",
     "scopes",
     "key_prefix",
     "is_test",
     "created_at"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "side": {
      "$ref": "#/components/schemas/Side"
     },
     "name": {
      "type": "string"
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "key_prefix": {
      "type": "string",
      "description": "First characters only, e.g. krin_sk_live_4fQ"
     },
     "ip_allowlist": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "type": "string"
      }
     },
     "is_test": {
      "type": "boolean"
     },
     "created_by": {
      "$ref": "#/components/schemas/ActorRef"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "revoked_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "last_used_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "ApiKeyPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ApiKey"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "ApiKeyCreate": {
    "type": "object",
    "required": [
     "name",
     "side",
     "scopes"
    ],
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
     },
     "side": {
      "$ref": "#/components/schemas/Side"
     },
     "scopes": {
      "type": "array",
      "minItems": 1,
      "maxItems": 32,
      "uniqueItems": true,
      "items": {
       "type": "string",
       "pattern": "^[a-z_]+:(read|write)$"
      },
      "description": "Scopes of the operations a key of this side can run (each operation names its scope); never a scope only people hold, such as keys:write."
     },
     "ip_allowlist": {
      "type": [
       "array",
       "null"
      ],
      "minItems": 1,
      "maxItems": 20,
      "items": {
       "type": "string"
      },
      "description": "IPv4 or IPv6 addresses or networks (203.0.113.0/24, 2001:db8::/32). Set = the key works only from them."
     },
     "is_test": {
      "type": "boolean",
      "default": false,
      "description": "A krin_sk_test_ key: made and used only while the organization is in sandbox."
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "In the future. Required, within 365 days, when any scope is a write scope."
     }
    }
   },
   "ApiKeyCreated": {
    "allOf": [
     {
      "$ref": "#/components/schemas/ApiKey"
     },
     {
      "type": "object",
      "required": [
       "secret"
      ],
      "properties": {
       "secret": {
        "type": "string",
        "description": "Full key. Shown once, never again."
       }
      }
     }
    ]
   },
   "AgentConnection": {
    "type": "object",
    "required": [
     "id",
     "side",
     "client_name",
     "scopes",
     "connected_by",
     "created_at"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "side": {
      "$ref": "#/components/schemas/Side"
     },
     "client_name": {
      "type": "string"
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "connected_by": {
      "$ref": "#/components/schemas/ActorRef"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "revoked_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "AgentConnectionPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AgentConnection"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "AgentPolicy": {
    "type": "object",
    "required": [
     "auto_classes",
     "confirm_classes",
     "daily_budget_increase_micros",
     "daily_topup_micros",
     "max_single_reversal_micros",
     "always_human"
    ],
    "properties": {
     "auto_classes": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "read",
        "write_config",
        "write_live",
        "money_move"
       ]
      }
     },
     "confirm_classes": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "read",
        "write_config",
        "write_live",
        "money_move"
       ]
      }
     },
     "daily_budget_increase_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "daily_topup_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "max_single_reversal_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "always_human": {
      "type": "array",
      "description": "Operations no policy can hand to an agent",
      "items": {
       "type": "string"
      }
     },
     "updated_by": {
      "$ref": "#/components/schemas/ActorRef"
     },
     "updated_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "AgentPolicyInput": {
    "type": "object",
    "required": [
     "auto_classes",
     "confirm_classes",
     "daily_budget_increase_micros",
     "daily_topup_micros",
     "max_single_reversal_micros"
    ],
    "additionalProperties": false,
    "properties": {
     "auto_classes": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "read",
        "write_config",
        "write_live",
        "money_move"
       ]
      }
     },
     "confirm_classes": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "read",
        "write_config",
        "write_live",
        "money_move"
       ]
      }
     },
     "daily_budget_increase_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "daily_topup_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "max_single_reversal_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     }
    }
   },
   "AuditEvent": {
    "type": "object",
    "required": [
     "id",
     "occurred_at",
     "actor",
     "operation_id",
     "label",
     "target_type"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "occurred_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "actor": {
      "$ref": "#/components/schemas/ActorRef"
     },
     "on_behalf_of": {
      "type": [
       "string",
       "null"
      ]
     },
     "operation_id": {
      "type": "string"
     },
     "label": {
      "type": "string",
      "description": "What happened, in a few words (the operation title, such as \"Revoke API key\"). Show this, never operation_id."
     },
     "target_type": {
      "type": "string"
     },
     "target_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "request_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "dry_run": {
      "type": "boolean"
     },
     "diff": {}
    }
   },
   "AuditEventPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AuditEvent"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "Notification": {
    "type": "object",
    "required": [
     "id",
     "kind",
     "title",
     "created_at"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "kind": {
      "type": "string"
     },
     "title": {
      "type": "string"
     },
     "body": {
      "type": "string"
     },
     "link": {
      "type": "string"
     },
     "read_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "NotificationPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Notification"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "Kyb": {
    "type": "object",
    "required": [
     "status"
    ],
    "properties": {
     "status": {
      "type": "string",
      "enum": [
       "not_started",
       "pending",
       "verified",
       "rejected"
      ]
     },
     "legal_name": {
      "type": [
       "string",
       "null"
      ]
     },
     "registration_number": {
      "type": [
       "string",
       "null"
      ]
     },
     "country": {
      "type": [
       "string",
       "null"
      ]
     },
     "documents": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "kind": {
         "type": "string"
        },
        "uploaded_at": {
         "$ref": "#/components/schemas/Timestamp"
        }
       }
      }
     },
     "decided_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "KybInput": {
    "type": "object",
    "required": [
     "legal_name",
     "country",
     "registration_number",
     "documents"
    ],
    "additionalProperties": false,
    "properties": {
     "legal_name": {
      "type": "string",
      "maxLength": 200
     },
     "country": {
      "$ref": "#/components/schemas/Country"
     },
     "registration_number": {
      "type": "string",
      "maxLength": 64
     },
     "address": {
      "type": "string",
      "maxLength": 400
     },
     "beneficial_owners": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "name",
        "country"
       ],
       "properties": {
        "name": {
         "type": "string"
        },
        "country": {
         "$ref": "#/components/schemas/Country"
        }
       }
      }
     },
     "documents": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "kind",
        "upload_id"
       ],
       "properties": {
        "kind": {
         "type": "string",
         "enum": [
          "registration",
          "id",
          "proof_of_address",
          "other"
         ]
        },
        "upload_id": {
         "type": "string"
        }
       }
      }
     }
    }
   },
   "MeetingRequest": {
    "type": "object",
    "required": [
     "email",
     "company",
     "needs"
    ],
    "additionalProperties": false,
    "properties": {
     "email": {
      "type": "string",
      "format": "email"
     },
     "company": {
      "type": "string",
      "maxLength": 120
     },
     "side": {
      "$ref": "#/components/schemas/Side"
     },
     "monthly_budget_band": {
      "type": "string",
      "enum": [
       "<5k",
       "5k-25k",
       "25k-100k",
       ">100k"
      ]
     },
     "needs": {
      "type": "string",
      "maxLength": 2000
     },
     "preferred_slots": {
      "type": "array",
      "maxItems": 5,
      "items": {
       "$ref": "#/components/schemas/Timestamp"
      }
     }
    }
   },
   "Review": {
    "type": "object",
    "required": [
     "id",
     "kind",
     "status",
     "created_at"
    ],
    "description": "What the requester sees. Internal notes and the deciding staff member are never included.",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rvw_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "kind": {
      "type": "string",
      "enum": [
       "publisher_tier",
       "first_campaign",
       "flagged_vertical",
       "check_exception"
      ]
     },
     "requested_tier": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "approved",
       "rejected",
       "withdrawn"
      ],
      "description": "withdrawn: closed without a decision, e.g. KRIN set the level from its own review of the account (no cooldown follows)"
     },
     "reason": {
      "type": [
       "string",
       "null"
      ],
      "description": "While pending, the text the requester wrote; once decided, the reason KRIN gives for the decision (\"KRIN set your level\" when KRIN set the level outside the review)"
     },
     "decided_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "TierReviewRequest": {
    "type": "object",
    "required": [
     "requested_tier",
     "reason"
    ],
    "additionalProperties": false,
    "properties": {
     "requested_tier": {
      "type": "string",
      "enum": [
       "approved",
       "vip"
      ]
     },
     "reason": {
      "type": "string",
      "maxLength": 2000
     },
     "traffic_description": {
      "type": "string",
      "maxLength": 2000
     }
    }
   },
   "StoreLookup": {
    "type": "object",
    "required": [
     "platform",
     "bundle_id",
     "store_url",
     "title"
    ],
    "properties": {
     "platform": {
      "type": "string",
      "enum": [
       "android",
       "ios"
      ]
     },
     "bundle_id": {
      "type": "string",
      "description": "Google Play package name, or the App Store numeric id (the form MMPs use)"
     },
     "store_url": {
      "type": "string",
      "format": "uri",
      "description": "The canonical store link KRIN keeps (put it in ProductInput.store_urls)"
     },
     "title": {
      "type": "string",
      "maxLength": 200,
      "description": "Store text, plain text only"
     },
     "developer": {
      "type": "string",
      "maxLength": 200
     },
     "category": {
      "type": "string",
      "maxLength": 80
     },
     "icon_url": {
      "type": "string",
      "format": "uri",
      "description": "Always https://cdn.krin.io/store-icons/..; left out when the icon could not be copied"
     },
     "rating": {
      "type": [
       "number",
       "null"
      ]
     },
     "countries": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Country"
      }
     },
     "fetched_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "ProductInput": {
    "type": "object",
    "required": [
     "kind",
     "name",
     "platforms"
    ],
    "additionalProperties": false,
    "properties": {
     "kind": {
      "type": "string",
      "enum": [
       "app",
       "web"
      ]
     },
     "name": {
      "type": "string",
      "maxLength": 120
     },
     "platforms": {
      "type": "array",
      "minItems": 1,
      "items": {
       "$ref": "#/components/schemas/Platform"
      }
     },
     "store_urls": {
      "type": "array",
      "maxItems": 2,
      "items": {
       "type": "string",
       "format": "uri"
      },
      "description": "App products: a Google Play and/or an App Store link (one per platform; each platform must be in platforms). The link sets that platform's bundle id."
     },
     "bundle_ids": {
      "type": "object",
      "additionalProperties": false,
      "description": "App products: bundle ids by platform, for a platform without a store link (a store link's own id must match). ios is the App Store numeric id. One product per app: a bundle id already on another product answers 409 product_exists.",
      "properties": {
       "android": {
        "type": "string",
        "pattern": "^[A-Za-z0-9._-]{1,255}$"
       },
       "ios": {
        "type": "string",
        "pattern": "^[0-9]{5,12}$"
       },
       "windows": {
        "type": "string",
        "pattern": "^[A-Za-z0-9._-]{1,255}$"
       },
       "macos": {
        "type": "string",
        "pattern": "^[A-Za-z0-9._-]{1,255}$"
       }
      }
     },
     "web_url": {
      "type": "string",
      "format": "uri",
      "description": "Required for a web product"
     },
     "category": {
      "type": "string",
      "maxLength": 80
     }
    }
   },
   "Product": {
    "allOf": [
     {
      "$ref": "#/components/schemas/ProductInput"
     },
     {
      "type": "object",
      "required": [
       "id",
       "created_at"
      ],
      "properties": {
       "id": {
        "$ref": "#/components/schemas/ProductId"
       },
       "store": {
        "oneOf": [
         {
          "type": "null"
         },
         {
          "$ref": "#/components/schemas/StoreLookup"
         }
        ]
       },
       "mmp": {
        "type": [
         "string",
         "null"
        ],
        "enum": [
         "appsflyer",
         "adjust",
         "singular",
         null
        ]
       },
       "created_at": {
        "$ref": "#/components/schemas/Timestamp"
       }
      }
     }
    ]
   },
   "ProductPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Product"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "CampaignInput": {
    "type": "object",
    "required": [
     "product_id",
     "name"
    ],
    "additionalProperties": false,
    "properties": {
     "product_id": {
      "$ref": "#/components/schemas/ProductId"
     },
     "name": {
      "type": "string",
      "maxLength": 120
     },
     "lifetime_budget_micros": {
      "type": [
       "integer",
       "null"
      ],
      "format": "int64",
      "minimum": 1,
      "description": "The lifetime budget, or null for no limit. Counts only from the owner, admin or finance role with a passkey confirmation (see advertiser.campaigns.create)"
     },
     "daily_budget_micros": {
      "type": [
       "integer",
       "null"
      ],
      "format": "int64",
      "minimum": 1,
      "description": "The daily budget, or null for no limit; at most the lifetime budget. Counts only from the owner, admin or finance role with a passkey confirmation"
     },
     "pacing": {
      "type": "string",
      "enum": [
       "even",
       "asap"
      ],
      "default": "even"
     },
     "starts_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "ends_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "CampaignUpdate": {
    "type": "object",
    "additionalProperties": false,
    "description": "A field left out keeps its value; null removes a budget or a date.",
    "properties": {
     "product_id": {
      "$ref": "#/components/schemas/ProductId",
      "description": "Only the campaign's own product: it does not change"
     },
     "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
     },
     "lifetime_budget_micros": {
      "type": [
       "integer",
       "null"
      ],
      "format": "int64",
      "minimum": 1,
      "description": "null removes the lifetime budget; never below spend_micros"
     },
     "daily_budget_micros": {
      "type": [
       "integer",
       "null"
      ],
      "format": "int64",
      "minimum": 1,
      "description": "null removes the daily budget; at most the lifetime budget"
     },
     "pacing": {
      "type": "string",
      "enum": [
       "even",
       "asap"
      ]
     },
     "starts_at": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "$ref": "#/components/schemas/Timestamp"
       }
      ]
     },
     "ends_at": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "$ref": "#/components/schemas/Timestamp"
       }
      ],
      "description": "In the future, after starts_at"
     }
    }
   },
   "Campaign": {
    "allOf": [
     {
      "$ref": "#/components/schemas/CampaignInput"
     },
     {
      "type": "object",
      "required": [
       "id",
       "status",
       "budget_state",
       "spend_micros",
       "created_at"
      ],
      "properties": {
       "id": {
        "$ref": "#/components/schemas/CampaignId"
       },
       "status": {
        "type": "string",
        "enum": [
         "draft",
         "active",
         "paused",
         "ended"
        ],
        "description": "A campaign starts in draft; KRIN moves it, never the advertiser"
       },
       "budget_state": {
        "allOf": [
         {
          "$ref": "#/components/schemas/CampaignBudgetState"
         }
        ],
        "description": "not_set: nobody with the owner, admin or finance role has chosen the budget yet, so the campaign spends nothing and its offers do not serve. set: the budgets as shown, where a missing budget means no limit."
       },
       "spend_micros": {
        "allOf": [
         {
          "$ref": "#/components/schemas/MicrosNonNeg"
         }
        ],
        "description": "Spend already booked: the cost of conversions that are not rejected, reversed or test"
       },
       "created_at": {
        "$ref": "#/components/schemas/Timestamp"
       }
      }
     }
    ]
   },
   "CampaignBudgetState": {
    "type": "string",
    "enum": [
     "set",
     "not_set"
    ]
   },
   "CampaignPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Campaign"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "OfferType": {
    "type": "string",
    "enum": [
     "cpi",
     "cpa",
     "cpe_single",
     "cpe_multi",
     "cpe_daily",
     "survey",
     "video",
     "playtime"
    ]
   },
   "OfferStatus": {
    "type": "string",
    "enum": [
     "draft",
     "checking",
     "needs_fix",
     "in_review",
     "live",
     "paused",
     "ended"
    ]
   },
   "PublisherTier": {
    "type": "string",
    "enum": [
     "sandbox",
     "starter",
     "approved",
     "vip"
    ]
   },
   "OfferEventInput": {
    "type": "object",
    "required": [
     "seq",
     "name",
     "event_key",
     "cost_micros"
    ],
    "additionalProperties": false,
    "properties": {
     "seq": {
      "type": "integer",
      "minimum": 1,
      "maximum": 50
     },
     "name": {
      "type": "string",
      "maxLength": 120,
      "description": "User-facing milestone name"
     },
     "event_key": {
      "type": "string",
      "pattern": "^[a-z0-9_.:-]{1,64}$",
      "description": "Event name as the MMP / S2S postback sends it"
     },
     "cost_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "instruction": {
      "type": "string",
      "maxLength": 500
     },
     "time_limit_hours": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 1,
      "description": "Hours from the click to reach this milestone; null = the whole attribution window. At most the attribution window in hours, and never shorter than an earlier milestone's (list milestones in the order users reach them)."
     },
     "repeatable": {
      "type": "boolean",
      "default": false
     },
     "max_repeats": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 1
     },
     "is_install": {
      "type": "boolean",
      "default": false
     }
    }
   },
   "AdvertiserOfferEvent": {
    "allOf": [
     {
      "$ref": "#/components/schemas/OfferEventInput"
     },
     {
      "type": "object",
      "required": [
       "id"
      ],
      "properties": {
       "id": {
        "$ref": "#/components/schemas/OfferEventId"
       }
      }
     }
    ]
   },
   "Targeting": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "countries": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Country"
      }
     },
     "exclude_countries": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Country"
      }
     },
     "platforms": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Platform"
      }
     },
     "min_os_version": {
      "type": "string"
     },
     "languages": {
      "type": "array",
      "items": {
       "type": "string",
       "pattern": "^[a-z]{2}$"
      }
     },
     "new_users_only": {
      "type": "boolean"
     },
     "device_types": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "phone",
        "tablet",
        "desktop"
       ]
      }
     }
    }
   },
   "OfferCaps": {
    "type": "object",
    "additionalProperties": false,
    "description": "Offer-level limits (demand.offer_caps). Budgets and pacing live on the campaign (set_budget). Omit a key for no cap.",
    "properties": {
     "daily_conversions": {
      "type": "integer",
      "minimum": 1
     },
     "lifetime_conversions": {
      "type": "integer",
      "minimum": 1
     },
     "daily_spend_micros": {
      "type": "integer",
      "minimum": 1,
      "description": "Offer daily spend cap. A raise by an agent counts toward the agent daily budget-increase limit."
     },
     "per_publisher_daily_conversions": {
      "type": "integer",
      "minimum": 1
     },
     "per_user_conversions": {
      "type": "integer",
      "minimum": 1
     }
    }
   },
   "OfferAgeFacts": {
    "type": "object",
    "additionalProperties": false,
    "description": "What the wall needs to show an offer to users under 18. Null = not known = not shown to them.",
    "properties": {
     "min_age": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0,
      "maximum": 21,
      "description": "Your minimum age for the offer. 18 or more = adults only."
     },
     "store_age_android": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0,
      "maximum": 18,
      "description": "The Google Play content rating as an age (Teen = 13). Empty = the rating KRIN reads from the store."
     },
     "store_age_ios": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0,
      "maximum": 18,
      "description": "The App Store age rating as an age (13+ = 13). Empty = the rating KRIN reads from the store."
     },
     "money_step": {
      "type": [
       "boolean",
       "null"
      ],
      "description": "Some step needs a purchase, a deposit, a subscription, a free trial that turns paid, or a payment method."
     },
     "data_step": {
      "type": [
       "boolean",
       "null"
      ],
      "description": "Some step needs a sign-up with personal data beyond an in-app account, a social share, or an invite."
     }
    }
   },
   "OfferTracking": {
    "type": "object",
    "description": "How the offer is tracked (null until set up). A draft sets it with tracking on create or update (OfferTrackingInput); a submitted offer changes it through a pending change.",
    "required": [
     "provider",
     "click_url_template",
     "app_id",
     "inbound_auth",
     "offer_key",
     "postback_url",
     "mtls_required",
     "inbound_secret_set",
     "inbound_secret_hint",
     "mmp_key_set",
     "mmp_key_set_at",
     "mmp_previous_key_valid_until"
    ],
    "properties": {
     "provider": {
      "type": "string",
      "enum": [
       "appsflyer",
       "adjust",
       "singular",
       "generic_s2s"
      ]
     },
     "click_url_template": {
      "type": "string",
      "description": "Where a click goes, with its macros filled. See OfferTrackingInput."
     },
     "app_id": {
      "type": [
       "string",
       "null"
      ],
      "description": "The app the MMP reports: the Android package, or the App Store id (digits, or id and the digits as AppsFlyer writes it)"
     },
     "inbound_auth": {
      "type": "string",
      "enum": [
       "hmac",
       "ip_allowlist",
       "hmac_and_ip",
       "mmp_ip_range"
      ],
      "readOnly": true,
      "description": "Set by KRIN. hmac (signature v2) or hmac_and_ip (signature and the IP allowlist); a new tracker starts on hmac and verifies nothing until an inbound secret exists. ip_allowlist alone verifies nothing: every postback answers 401. mmp_ip_range only for appsflyer/adjust/singular trackers bound to an app id, with an MMP key set, and while KRIN holds a live published range for that MMP. A URL key alone never authenticates."
     },
     "offer_key": {
      "type": "string",
      "readOnly": true,
      "description": "Route key of the postback URL (ok_ and 16 letters or digits). Not a secret and never enough on its own"
     },
     "postback_url": {
      "type": [
       "string",
       "null"
      ],
      "readOnly": true,
      "description": "Where postbacks go: https://t.krin.io/pb/{offer_key} for signed S2S postbacks (https://s2s.krin.io/pb/{offer_key} when mtls_required), or https://t.krin.io/mmp/{provider} once the tracker is on mmp_ip_range"
     },
     "mtls_required": {
      "type": "boolean",
      "readOnly": true,
      "description": "Postbacks are accepted only on s2s.krin.io with one of the offer's client certificates"
     },
     "inbound_secret_set": {
      "type": "boolean",
      "readOnly": true,
      "description": "An inbound postback secret exists (advertiser.tracking.rotate_inbound_secret; the secret itself is shown once)"
     },
     "inbound_secret_hint": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^[0-9a-f]{4}$",
      "readOnly": true,
      "description": "The last 4 characters of the current secret"
     },
     "mmp_key_set": {
      "type": "boolean",
      "readOnly": true,
      "description": "An MMP key exists (rotate it with advertiser.tracking.rotate_mmp_key; the key itself is shown once)"
     },
     "mmp_key_set_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "readOnly": true
     },
     "mmp_previous_key_valid_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "readOnly": true,
      "description": "After a rotation the previous key still works until then"
     }
    }
   },
   "OfferTrackingInput": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "provider",
     "click_url_template"
    ],
    "properties": {
     "provider": {
      "type": "string",
      "enum": [
       "appsflyer",
       "adjust",
       "singular",
       "generic_s2s"
      ]
     },
     "click_url_template": {
      "type": "string",
      "maxLength": 2048,
      "description": "An https link on the provider's own host, with no user name or port and {click_id} in it. AppsFlyer: app.appsflyer.com or <name>.onelink.me; Adjust: app.adjust.com, app.adjust.io, app.adjust.world or app.adjust.net.in; Singular: <name>.sng.link, c.singular.net or c.apsalar.com; generic_s2s: a public host of yours (not krin.io). Macros: {click_id} {sub_source} {country} {platform} {gaid} {idfa}"
     },
     "app_id": {
      "type": "string",
      "maxLength": 255,
      "description": "The product's app this tracker reports: the Android package, or the App Store id (digits, or id and the digits). Left out, KRIN takes the product's app on the offer's platform; an offer on both android and ios names one (one app per tracker). Required for an MMP on a two-platform offer."
     }
    }
   },
   "SecretRotationInput": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "grace_hours": {
      "type": "integer",
      "minimum": 0,
      "maximum": 168,
      "description": "How long the previous one keeps working"
     }
    }
   },
   "InboundSecretRotation": {
    "type": "object",
    "required": [
     "secret",
     "hint",
     "previous_valid_until"
    ],
    "properties": {
     "secret": {
      "type": "string",
      "pattern": "^kin_live_[0-9a-f]{64}$",
      "description": "The new inbound postback secret: sign postbacks with it. Shown once; an idempotent replay answers 409 secret_already_shown."
     },
     "hint": {
      "type": "string",
      "pattern": "^[0-9a-f]{4}$",
      "description": "Its last 4 characters, as the offer shows them later"
     },
     "previous_valid_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "The previous secret verifies until then"
     }
    }
   },
   "MmpKeyRotation": {
    "type": "object",
    "required": [
     "mmp_key",
     "parameter",
     "set_at"
    ],
    "properties": {
     "mmp_key": {
      "type": "string",
      "pattern": "^[0-9a-f]{32}$",
      "description": "128 random bits as 32 lowercase hex characters. Shown once; an idempotent replay never returns it again"
     },
     "parameter": {
      "type": "string",
      "const": "k",
      "description": "The postback parameter that carries the key"
     },
     "set_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "previous_key_valid_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "inbound_auth": {
      "type": "string",
      "enum": [
       "hmac",
       "ip_allowlist",
       "hmac_and_ip",
       "mmp_ip_range"
      ],
      "description": "The tracker's mode after the rotation: a draft AppsFlyer, Adjust or Singular tracker without an inbound secret moves to mmp_ip_range with its first key while KRIN holds that MMP's published ranges"
     }
    }
   },
   "OfferCreatives": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "icon_url": {
      "type": "string",
      "format": "uri"
     },
     "hero_url": {
      "type": "string",
      "format": "uri"
     },
     "short_description": {
      "type": "string",
      "maxLength": 140
     },
     "instructions": {
      "type": "string",
      "maxLength": 2000,
      "description": "Plain text, one step per line (at most 20 steps); the wall shows them as steps"
     }
    }
   },
   "AdvertiserOfferInput": {
    "type": "object",
    "required": [
     "campaign_id",
     "product_id",
     "type",
     "title",
     "reversal_window_days",
     "events"
    ],
    "additionalProperties": false,
    "properties": {
     "campaign_id": {
      "$ref": "#/components/schemas/CampaignId"
     },
     "product_id": {
      "$ref": "#/components/schemas/ProductId"
     },
     "type": {
      "$ref": "#/components/schemas/OfferType"
     },
     "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
     },
     "vertical": {
      "type": "string"
     },
     "reversal_window_days": {
      "type": "integer",
      "minimum": 14,
      "maximum": 30,
      "description": "Binding on you: after it the conversion is final (krin.settings offers.reversal_window_*). Locked after submit."
     },
     "attribution_window_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 90
     },
     "is_private": {
      "type": "boolean",
      "default": false,
      "description": "Enterprise; visible only to allowlisted publishers"
     },
     "events": {
      "type": "array",
      "minItems": 1,
      "maxItems": 50,
      "items": {
       "$ref": "#/components/schemas/OfferEventInput"
      }
     },
     "targeting": {
      "$ref": "#/components/schemas/Targeting"
     },
     "caps": {
      "$ref": "#/components/schemas/OfferCaps"
     },
     "tracking": {
      "$ref": "#/components/schemas/OfferTracking"
     },
     "creatives": {
      "$ref": "#/components/schemas/OfferCreatives"
     }
    }
   },
   "AdvertiserOfferUpdate": {
    "type": "object",
    "additionalProperties": false,
    "description": "Any field group may be sent alone. reversal_window_days is refused after submit.",
    "properties": {
     "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
     },
     "vertical": {
      "type": "string"
     },
     "reversal_window_days": {
      "type": "integer",
      "minimum": 14,
      "maximum": 30
     },
     "attribution_window_days": {
      "type": "integer",
      "minimum": 1,
      "maximum": 90
     },
     "is_private": {
      "type": "boolean"
     },
     "events": {
      "type": "array",
      "maxItems": 50,
      "items": {
       "$ref": "#/components/schemas/OfferEventInput"
      }
     },
     "targeting": {
      "$ref": "#/components/schemas/Targeting"
     },
     "caps": {
      "$ref": "#/components/schemas/OfferCaps"
     },
     "tracking": {
      "$ref": "#/components/schemas/OfferTrackingInput"
     },
     "creatives": {
      "$ref": "#/components/schemas/OfferCreatives"
     }
    }
   },
   "AdvertiserOffer": {
    "type": "object",
    "required": [
     "id",
     "campaign_id",
     "product_id",
     "type",
     "title",
     "status",
     "reversal_window_days",
     "events",
     "created_at"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "campaign_id": {
      "$ref": "#/components/schemas/CampaignId"
     },
     "product_id": {
      "$ref": "#/components/schemas/ProductId"
     },
     "type": {
      "$ref": "#/components/schemas/OfferType"
     },
     "title": {
      "type": "string"
     },
     "vertical": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "$ref": "#/components/schemas/OfferStatus"
     },
     "status_reasons": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "Failed check keys, review_rejected, or pause reason codes"
     },
     "min_publisher_tier": {
      "$ref": "#/components/schemas/PublisherTier"
     },
     "reversal_window_days": {
      "type": "integer"
     },
     "attribution_window_days": {
      "type": [
       "integer",
       "null"
      ]
     },
     "is_private": {
      "type": "boolean"
     },
     "events": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AdvertiserOfferEvent"
      }
     },
     "targeting": {
      "$ref": "#/components/schemas/Targeting"
     },
     "caps": {
      "$ref": "#/components/schemas/OfferCaps"
     },
     "tracking": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/OfferTracking"
       },
       {
        "type": "null"
       }
      ],
      "description": "null until the offer's tracking is set up"
     },
     "creatives": {
      "$ref": "#/components/schemas/OfferCreatives"
     },
     "age_facts": {
      "$ref": "#/components/schemas/OfferAgeFacts"
     },
     "spend_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "latest_change": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/OfferChange"
       },
       {
        "type": "null"
       }
      ],
      "description": "The most recent proposed change of a live or paused offer, if any"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "updated_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "OfferChangeInput": {
    "type": "object",
    "additionalProperties": false,
    "minProperties": 1,
    "description": "Only the fields that change. events replaces the milestones as a whole: every existing event_key stays with its seq and kind; name, cost_micros and instruction may change; new milestones come after.",
    "properties": {
     "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
     },
     "vertical": {
      "type": "string"
     },
     "events": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/OfferEventInput"
      }
     },
     "targeting": {
      "$ref": "#/components/schemas/Targeting"
     },
     "creatives": {
      "$ref": "#/components/schemas/OfferCreatives"
     }
    }
   },
   "OfferChange": {
    "type": "object",
    "required": [
     "id",
     "status",
     "results",
     "created_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^och_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "status": {
      "type": "string",
      "enum": [
       "needs_fix",
       "in_review",
       "applied",
       "rejected",
       "withdrawn",
       "superseded"
      ],
      "description": "needs_fix: a check failed (results); in_review: a person at KRIN reviews it; applied: it replaced the live version; rejected: the live version stays (reason); withdrawn: the offer ended; superseded: a newer proposal replaced it"
     },
     "results": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "check_key",
        "result"
       ],
       "properties": {
        "check_key": {
         "type": "string"
        },
        "result": {
         "type": "string",
         "enum": [
          "pass",
          "fail",
          "warn",
          "skipped"
         ]
        },
        "message": {
         "type": "string"
        }
       }
      }
     },
     "reason": {
      "type": [
       "string",
       "null"
      ],
      "description": "Set once KRIN decided, or why it was withdrawn or replaced"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "decided_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "AdvertiserOfferPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AdvertiserOffer"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "OfferCheckRun": {
    "type": "object",
    "required": [
     "run_id",
     "started_at",
     "results"
    ],
    "properties": {
     "run_id": {
      "type": "string",
      "pattern": "^chk_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "started_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "finished_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "outcome": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "needs_fix",
       "in_review",
       "live",
       null
      ],
      "description": "Where the run left the offer: needs_fix (a check failed; status_reasons lists them), in_review (a person at KRIN decides) or live"
     },
     "results": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "check_key",
        "result"
       ],
       "properties": {
        "check_key": {
         "type": "string"
        },
        "result": {
         "type": "string",
         "enum": [
          "pass",
          "fail",
          "warn",
          "skipped"
         ]
        },
        "message": {
         "type": "string",
         "description": "Plain English text for the advertiser: what passed, or what to fix"
        }
       }
      }
     },
     "review": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "status": {
        "type": "string",
        "enum": [
         "pending",
         "approved",
         "rejected",
         "withdrawn"
        ]
       },
       "reason": {
        "type": [
         "string",
         "null"
        ],
        "description": "Set once a person at KRIN decided: the reason they gave"
       }
      }
     }
    }
   },
   "TrackingTest": {
    "type": "object",
    "required": [
     "id",
     "status",
     "steps"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "running",
       "passed",
       "failed"
      ]
     },
     "steps": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "step",
        "status"
       ],
       "properties": {
        "step": {
         "type": "string",
         "enum": [
          "click_created",
          "redirect_resolved",
          "store_reached",
          "postback_received",
          "event_matched"
         ]
        },
        "status": {
         "type": "string",
         "enum": [
          "pending",
          "ok",
          "failed"
         ]
        },
        "detail": {
         "type": "string"
        },
        "at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time"
        }
       }
      }
     }
    }
   },
   "PrivateBidInput": {
    "type": "object",
    "required": [
     "offer_event_id",
     "publisher_org_id",
     "cost_micros"
    ],
    "additionalProperties": false,
    "properties": {
     "offer_event_id": {
      "$ref": "#/components/schemas/OfferEventId"
     },
     "publisher_org_id": {
      "$ref": "#/components/schemas/OrgId"
     },
     "cost_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "valid_from": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "valid_to": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "PrivateBid": {
    "allOf": [
     {
      "$ref": "#/components/schemas/PrivateBidInput"
     },
     {
      "type": "object",
      "required": [
       "id"
      ],
      "properties": {
       "id": {
        "type": "string"
       },
       "publisher_name": {
        "type": "string"
       }
      }
     }
    ]
   },
   "CampaignDraftRequest": {
    "type": "object",
    "required": [
     "store_url"
    ],
    "additionalProperties": false,
    "properties": {
     "store_url": {
      "type": "string",
      "format": "uri"
     },
     "goal": {
      "type": "string",
      "enum": [
       "installs",
       "engagement",
       "purchases",
       "retention"
      ],
      "default": "engagement"
     },
     "countries": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Country"
      }
     },
     "budget_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     }
    }
   },
   "CampaignDraft": {
    "type": "object",
    "required": [
     "product",
     "campaign",
     "offer",
     "notes"
    ],
    "description": "A complete, not-yet-created proposal. The client shows it as a diff and then calls the create operations.",
    "properties": {
     "product": {
      "$ref": "#/components/schemas/ProductInput"
     },
     "campaign": {
      "type": "object",
      "properties": {
       "name": {
        "type": "string"
       },
       "lifetime_budget_micros": {
        "$ref": "#/components/schemas/MicrosNonNeg"
       }
      }
     },
     "offer": {
      "type": "object",
      "description": "AdvertiserOfferInput without campaign_id and product_id"
     },
     "notes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "model": {
      "type": "object",
      "properties": {
       "task": {
        "type": "string"
       },
       "provider": {
        "type": "string"
       },
       "model": {
        "type": "string"
       }
      }
     }
    }
   },
   "ConversionStatus": {
    "type": "string",
    "enum": [
     "received",
     "held",
     "approved",
     "rejected",
     "reversing",
     "reversed",
     "settled"
    ]
   },
   "AdvertiserConversion": {
    "type": "object",
    "required": [
     "id",
     "offer_id",
     "event_key",
     "status",
     "cost_micros",
     "source_id",
     "event_at"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/ConversionId"
     },
     "click_id": {
      "$ref": "#/components/schemas/ClickId"
     },
     "offer_id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "event_key": {
      "type": "string"
     },
     "occurrence": {
      "type": "integer"
     },
     "source_id": {
      "$ref": "#/components/schemas/SubSourceId"
     },
     "country": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "$ref": "#/components/schemas/ConversionStatus"
     },
     "status_reason_code": {
      "type": [
       "string",
       "null"
      ],
      "description": "The real code for your own rules and for KRIN's actionable codes (state-machines.yaml reason_codes.conversion); a concealed KRIN code reads under_review or not_credited (public_reason_codes)"
     },
     "cost_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "event_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "approved_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "settles_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "After this the conversion is final"
     },
     "reversible": {
      "type": "boolean"
     }
    }
   },
   "AdvertiserConversionPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/AdvertiserConversion"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "ReversalInput": {
    "type": "object",
    "required": [
     "reason_code",
     "evidence"
    ],
    "additionalProperties": false,
    "properties": {
     "reason_code": {
      "type": "string",
      "enum": [
       "fraud_device_farm",
       "fraud_vpn_geo",
       "fraud_event_spoofing",
       "fraud_click_injection",
       "duplicate_user",
       "mmp_rejected",
       "purchase_refunded",
       "terms_violation",
       "source_reversed"
      ]
     },
     "evidence": {
      "type": "object",
      "description": "Exactly the keys of the reason, each plain text of 1 to 4000 characters. Every reason needs summary, and also: fraud_device_farm device_ids; fraud_vpn_geo observed_country; fraud_event_spoofing, fraud_click_injection and mmp_rejected mmp_report_ref; duplicate_user original_ref; purchase_refunded transaction_ref; terms_violation term; source_reversed source_ref.",
      "additionalProperties": {
       "type": "string",
       "minLength": 1,
       "maxLength": 4000
      }
     }
    }
   },
   "Reversal": {
    "type": "object",
    "required": [
     "id",
     "conversion_id",
     "reason_code",
     "filed_at",
     "status",
     "actor"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "conversion_id": {
      "$ref": "#/components/schemas/ConversionId"
     },
     "reason_code": {
      "type": "string"
     },
     "evidence": {
      "type": "object"
     },
     "filed_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "status": {
      "type": "string",
      "enum": [
       "reversing",
       "reversed"
      ]
     },
     "amount_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "actor": {
      "$ref": "#/components/schemas/ActorRef"
     }
    }
   },
   "ReversalPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Reversal"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "SourceQualityRow": {
    "type": "object",
    "required": [
     "source_id",
     "clicks",
     "installs"
    ],
    "description": "Raw facts only. No score, no grade (v1.2",
    "properties": {
     "source_id": {
      "$ref": "#/components/schemas/SubSourceId"
     },
     "clicks": {
      "type": "integer"
     },
     "installs": {
      "type": "integer"
     },
     "events": {
      "type": "object",
      "additionalProperties": {
       "type": "integer"
      },
      "description": "count per event_key"
     },
     "median_minutes_to_install": {
      "type": [
       "number",
       "null"
      ]
     },
     "retention_d1": {
      "type": [
       "number",
       "null"
      ]
     },
     "retention_d7": {
      "type": [
       "number",
       "null"
      ]
     },
     "retention_d30": {
      "type": [
       "number",
       "null"
      ]
     },
     "roas_d7": {
      "type": [
       "number",
       "null"
      ]
     },
     "integrity_pass_rate": {
      "type": [
       "number",
       "null"
      ]
     },
     "reversal_rate": {
      "type": [
       "number",
       "null"
      ]
     },
     "spend_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "status": {
      "type": "string",
      "enum": [
       "allowed",
       "paused",
       "blocked"
      ]
     }
    }
   },
   "SourceQualityReport": {
    "type": "object",
    "required": [
     "from",
     "to",
     "rows"
    ],
    "properties": {
     "from": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "to": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "rows": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/SourceQualityRow"
      }
     }
    }
   },
   "OfferSourceListInput": {
    "type": "object",
    "required": [
     "sources"
    ],
    "additionalProperties": false,
    "properties": {
     "sources": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1000,
      "description": "Each source once",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "source_id",
        "status"
       ],
       "properties": {
        "source_id": {
         "$ref": "#/components/schemas/SubSourceId"
        },
        "status": {
         "type": "string",
         "enum": [
          "allowed",
          "paused",
          "blocked"
         ]
        }
       }
      }
     }
    }
   },
   "SourceMultiplierListInput": {
    "type": "object",
    "required": [
     "sources"
    ],
    "additionalProperties": false,
    "properties": {
     "sources": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1000,
      "description": "Each source once",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "source_id",
        "multiplier"
       ],
       "properties": {
        "source_id": {
         "$ref": "#/components/schemas/SubSourceId"
        },
        "multiplier": {
         "$ref": "#/components/schemas/SourceMultiplier"
        }
       }
      }
     }
    }
   },
   "SourceMultiplier": {
    "type": "string",
    "pattern": "^(0\\.(2[5-9]|[3-9][0-9])|1\\.[0-9]{2}|2\\.00)$",
    "description": "A multiplier on your bid for one source, 0.25 to 2.00 with two decimals; 1.00 = none",
    "examples": [
     "0.80",
     "1.25"
    ]
   },
   "OfferSourceList": {
    "type": "object",
    "required": [
     "offer_id",
     "sources"
    ],
    "properties": {
     "offer_id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "sources": {
      "type": "array",
      "description": "The sources with a state other than allowed or a multiplier other than 1.00, newest change first",
      "items": {
       "type": "object",
       "required": [
        "source_id",
        "status",
        "multiplier",
        "changed_by",
        "changed_at"
       ],
       "properties": {
        "source_id": {
         "$ref": "#/components/schemas/SubSourceId"
        },
        "status": {
         "type": "string",
         "enum": [
          "allowed",
          "paused",
          "blocked"
         ]
        },
        "multiplier": {
         "$ref": "#/components/schemas/SourceMultiplier"
        },
        "changed_by": {
         "$ref": "#/components/schemas/ActorRef"
        },
        "changed_at": {
         "$ref": "#/components/schemas/Timestamp"
        }
       }
      }
     }
    }
   },
   "MmpConnectionInput": {
    "type": "object",
    "required": [
     "product_id",
     "mmp"
    ],
    "additionalProperties": false,
    "properties": {
     "product_id": {
      "$ref": "#/components/schemas/ProductId"
     },
     "mmp": {
      "type": "string",
      "enum": [
       "appsflyer",
       "adjust",
       "singular"
      ]
     },
     "app_id": {
      "type": "string",
      "maxLength": 255,
      "description": "The product's app this MMP measures: the Android package, or the App Store id (digits, or id and the digits). Left out, KRIN takes the product's app when it has one; a product with both names one."
     }
    }
   },
   "MmpConnection": {
    "type": "object",
    "required": [
     "id",
     "product_id",
     "mmp",
     "app_id",
     "status",
     "validation_until",
     "last_event_at",
     "last_error",
     "created_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^mmc_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "product_id": {
      "$ref": "#/components/schemas/ProductId"
     },
     "mmp": {
      "type": "string",
      "enum": [
       "appsflyer",
       "adjust",
       "singular"
      ]
     },
     "app_id": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "validating",
       "active",
       "error"
      ],
      "description": "pending: no offer of the product is tracked through it yet; validating: an offer is, with no conversion in the last 30 days; active: conversions in the last 30 days"
     },
     "validation_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "Offers limited to approved/vip publishers until then"
     },
     "last_event_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "The latest conversion measured through this MMP for the product (last 30 days)"
     },
     "last_error": {
      "type": [
       "string",
       "null"
      ]
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "MmpEventName": {
    "type": "object",
    "required": [
     "event_key",
     "seen_count_7d",
     "last_seen_at",
     "declared"
    ],
    "description": "An event key the product's MMP sent in the last 7 days (authenticated MMP postbacks only; at most 100, newest first)",
    "properties": {
     "event_key": {
      "type": "string"
     },
     "seen_count_7d": {
      "type": "integer"
     },
     "last_seen_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "declared": {
      "type": "boolean",
      "description": "One of the product's offers already has a milestone with this event key"
     }
    }
   },
   "AdvertiserBalance": {
    "type": "object",
    "required": [
     "prepaid_micros",
     "receivable_micros",
     "committed_today_micros"
    ],
    "properties": {
     "prepaid_micros": {
      "$ref": "#/components/schemas/Micros"
     },
     "receivable_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "committed_today_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "runway_days": {
      "type": [
       "number",
       "null"
      ],
      "description": "At the trailing 7-day spend rate"
     },
     "card_topup_remaining_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     }
    }
   },
   "TopupInput": {
    "type": "object",
    "required": [
     "method",
     "amount_micros"
    ],
    "additionalProperties": false,
    "properties": {
     "method": {
      "type": "string",
      "enum": [
       "card",
       "wire",
       "ach",
       "crypto"
      ]
     },
     "amount_micros": {
      "type": "integer",
      "format": "int64",
      "minimum": 10000000
     }
    }
   },
   "WireTopupInput": {
    "type": "object",
    "required": [
     "amount_micros"
    ],
    "additionalProperties": false,
    "properties": {
     "amount_micros": {
      "type": "integer",
      "format": "int64",
      "minimum": 1,
      "description": "The amount you will send, in micro-USD. KRIN's smallest and largest wire apply (today 100 USD to 250,000 USD); outside them 400 at /amount_micros"
     }
    }
   },
   "WireInstructions": {
    "type": "object",
    "description": "KRIN's bank details for one wire top-up, from KRIN's server only. KRIN never sends new bank details by email.",
    "required": [
     "reference",
     "beneficiary_name",
     "beneficiary_address",
     "bank_name",
     "bank_address",
     "account_number",
     "routing_number",
     "swift_bic",
     "iban",
     "currency"
    ],
    "properties": {
     "reference": {
      "type": "string",
      "pattern": "^KRN-[0-9A-HJKMNP-TV-Z]{10}$",
      "description": "Quote it on the transfer so KRIN can match the wire"
     },
     "beneficiary_name": {
      "type": "string"
     },
     "beneficiary_address": {
      "type": "string"
     },
     "bank_name": {
      "type": "string"
     },
     "bank_address": {
      "type": "string"
     },
     "account_number": {
      "type": "string"
     },
     "routing_number": {
      "type": [
       "string",
       "null"
      ]
     },
     "swift_bic": {
      "type": "string"
     },
     "iban": {
      "type": [
       "string",
       "null"
      ]
     },
     "currency": {
      "type": "string",
      "enum": [
       "USD"
      ]
     }
    }
   },
   "Topup": {
    "type": "object",
    "required": [
     "id",
     "method",
     "amount_micros",
     "status",
     "created_at"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/TopupId"
     },
     "method": {
      "type": "string",
      "enum": [
       "card",
       "wire",
       "ach",
       "crypto"
      ]
     },
     "amount_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "clearing",
       "succeeded",
       "failed",
       "charged_back",
       "refunded",
       "expired",
       "cancelled"
      ],
      "description": "A wire goes pending -> succeeded (credited), expired (no wire by expires_at) or cancelled"
     },
     "credited_micros": {
      "type": [
       "integer",
       "null"
      ],
      "format": "int64",
      "minimum": 0,
      "description": "What KRIN credited to your balance: the amount its bank received, never more (a wire can arrive short after bank fees). null until credited"
     },
     "reference": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^KRN-[0-9A-HJKMNP-TV-Z]{10}$",
      "description": "Wire: the reference to quote on the transfer"
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "Wire: a pending top-up expires at this time"
     },
     "payment_link": {
      "type": [
       "string",
       "null"
      ],
      "format": "uri"
     },
     "instructions": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "$ref": "#/components/schemas/WireInstructions"
       }
      ],
      "description": "A pending wire on advertiser.billing.wire_topups.create and advertiser.billing.topups.get; null in lists and once the top-up has ended"
     },
     "clears_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "TopupEvent": {
    "type": "object",
    "required": [
     "id",
     "method",
     "amount_micros",
     "status",
     "created_at"
    ],
    "description": "The data of the topup.succeeded webhook: a Topup without the wire reference, the bank instructions or a payment link. KRIN's bank details reach you only in the API's own answers, never by webhook or email; read the top-up by id for the rest",
    "properties": {
     "id": {
      "$ref": "#/components/schemas/TopupId"
     },
     "method": {
      "type": "string",
      "enum": [
       "card",
       "wire",
       "ach",
       "crypto"
      ]
     },
     "amount_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "clearing",
       "succeeded",
       "failed",
       "charged_back",
       "refunded",
       "expired",
       "cancelled"
      ]
     },
     "credited_micros": {
      "type": [
       "integer",
       "null"
      ],
      "format": "int64",
      "minimum": 0,
      "description": "What KRIN credited to your balance: the amount its bank received, never more"
     },
     "clears_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "TopupPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Topup"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "AutoTopup": {
    "type": "object",
    "required": [
     "enabled"
    ],
    "additionalProperties": false,
    "properties": {
     "enabled": {
      "type": "boolean"
     },
     "threshold_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "amount_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "method": {
      "type": "string",
      "enum": [
       "card",
       "ach"
      ]
     }
    }
   },
   "Invoice": {
    "type": "object",
    "required": [
     "id",
     "period_start",
     "period_end",
     "spend_micros",
     "has_pdf",
     "issued_at"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/InvoiceId"
     },
     "period_start": {
      "type": "string",
      "format": "date"
     },
     "period_end": {
      "type": "string",
      "format": "date"
     },
     "spend_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "has_pdf": {
      "type": "boolean",
      "description": "The PDF can be downloaded with advertiser.billing.invoices.pdf"
     },
     "issued_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "InvoicePage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Invoice"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PublisherProfile": {
    "type": "object",
    "required": [
     "tier",
     "net_days",
     "min_payout_micros",
     "caps",
     "next_level"
    ],
    "properties": {
     "tier": {
      "$ref": "#/components/schemas/PublisherTier"
     },
     "net_days": {
      "type": "integer",
      "enum": [
       15,
       30
      ]
     },
     "min_payout_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "caps": {
      "type": "object",
      "properties": {
       "daily_earnings_micros": {
        "type": [
         "integer",
         "null"
        ],
        "format": "int64"
       },
       "demand": {
        "type": "array",
        "items": {
         "type": "string",
         "enum": [
          "test_offers",
          "sourced",
          "direct"
         ]
        }
       }
      }
     },
     "next_level": {
      "type": [
       "object",
       "null"
      ],
      "description": "The level after this one (null at vip). unlocks and facts_considered are codes the console words.",
      "properties": {
       "tier": {
        "$ref": "#/components/schemas/PublisherTier"
       },
       "unlocks": {
        "type": "array",
        "items": {
         "type": "string",
         "enum": [
          "live_traffic",
          "sourced_offers",
          "starter_direct_offers",
          "direct_offers",
          "standard_caps",
          "net_15",
          "custom_terms",
          "higher_caps"
         ]
        }
       },
       "facts_considered": {
        "type": "array",
        "items": {
         "type": "string",
         "enum": [
          "property_added",
          "integration_verified",
          "promotion_rules_accepted",
          "traffic_quality",
          "integration_quality",
          "promotion_channels",
          "volume"
         ]
        }
       },
       "review": {
        "oneOf": [
         {
          "type": "null"
         },
         {
          "$ref": "#/components/schemas/Review"
         }
        ],
        "description": "The latest review asked for this level since the current level was set (pending, approved or rejected); null when there is none or the next level comes on its own"
       }
      }
     },
     "promotion_rules_accepted_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "PropertyInput": {
    "type": "object",
    "required": [
     "kind",
     "platform",
     "name"
    ],
    "additionalProperties": false,
    "properties": {
     "kind": {
      "type": "string",
      "enum": [
       "app",
       "site"
      ]
     },
     "platform": {
      "$ref": "#/components/schemas/Platform"
     },
     "name": {
      "type": "string",
      "maxLength": 120
     },
     "bundle_id": {
      "type": "string"
     },
     "url": {
      "type": "string",
      "format": "uri"
     },
     "promotion_channels": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "android_signing_sha256": {
      "type": [
       "array",
       "null"
      ],
      "minItems": 1,
      "maxItems": 5,
      "items": {
       "type": "string",
       "pattern": "^([0-9a-fA-F]{64}|([0-9A-Fa-f]{2}:){31}[0-9A-Fa-f]{2})$"
      },
      "description": "Android apps only: the SHA-256 fingerprint of the app signing certificate (with Play App Signing, the app signing key certificate in Play Console; colons allowed). The SDK's key attestation must show this app and one of these certificates, or no SDK session opens. Answered as 64 lowercase hex; null clears it."
     }
    }
   },
   "Property": {
    "allOf": [
     {
      "$ref": "#/components/schemas/PropertyInput"
     },
     {
      "type": "object",
      "required": [
       "id",
       "created_at"
      ],
      "properties": {
       "id": {
        "$ref": "#/components/schemas/PropertyId"
       },
       "placements_count": {
        "type": "integer"
       },
       "created_at": {
        "$ref": "#/components/schemas/Timestamp"
       }
      }
     }
    ]
   },
   "PropertyPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Property"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PlacementStatus": {
    "type": "string",
    "enum": [
     "draft",
     "testing",
     "live",
     "paused"
    ]
   },
   "PlacementKind": {
    "type": "string",
    "enum": [
     "offers",
     "surveys",
     "mixed",
     "video",
     "playtime"
    ],
    "description": "Offer and survey walls are separate placements; mixed is optional. video and playtime are Wave 2. The headless Offer API is an integration of any kind, not a kind."
   },
   "LaunchMode": {
    "type": "string",
    "enum": [
     "signed",
     "public_web"
    ],
    "default": "signed",
    "description": "Unsigned opens only for placements marked public_web, under a baseline rule"
   },
   "Currency": {
    "type": "object",
    "required": [
     "name",
     "per_usd"
    ],
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 40
     },
     "name_plural": {
      "type": "string",
      "maxLength": 40
     },
     "icon_url": {
      "type": "string",
      "format": "uri"
     },
     "per_usd": {
      "$ref": "#/components/schemas/DecimalString"
     },
     "decimals": {
      "type": "integer",
      "minimum": 0,
      "maximum": 4
     },
     "rounding": {
      "type": "string",
      "enum": [
       "floor",
       "round",
       "ceil"
      ]
     },
     "min_reward": {
      "$ref": "#/components/schemas/DecimalString"
     },
     "geo_multipliers": {
      "type": "object",
      "additionalProperties": {
       "$ref": "#/components/schemas/DecimalString"
      },
      "description": "Country code -> multiplier on the user reward"
     }
    }
   },
   "WallTheme": {
    "type": "object",
    "additionalProperties": false,
    "description": "Wall theme tokens, mirroring Design's packages/ui/wall-theme-contract.json v4 (Design owns it). Values are tokens, never raw HTML or CSS. A field left out takes the contract's default on the wall; setting the theme replaces it whole. Currency name and icon are placement fields, not theme fields.",
    "properties": {
     "mode": {
      "type": "string",
      "enum": [
       "light",
       "dark",
       "auto"
      ],
      "default": "dark"
     },
     "accent": {
      "type": "string",
      "pattern": "^#[0-9a-fA-F]{6}$",
      "description": "The wall adjusts it to reach WCAG 2.2 AA on the surface. Default KRIN Ruby (#B01538 dark, #8F102D light)"
     },
     "surface": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^#[0-9a-fA-F]{6}$",
      "description": "Optional; text colors are derived from it with contrast enforced"
     },
     "radius": {
      "type": "string",
      "enum": [
       "sharp",
       "soft",
       "round"
      ],
      "default": "soft"
     },
     "font": {
      "type": "string",
      "enum": [
       "krin",
       "system",
       "rounded",
       "condensed"
      ],
      "default": "krin",
      "description": "Self-hosted families only (CSP)"
     },
     "logo": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 300,
      "pattern": "^https://cdn\\.krin\\.io/",
      "description": "An uploaded logo (PNG or WebP, at most 200 KB), re-encoded and served from cdn.krin.io; no SVG"
     },
     "layout": {
      "type": "string",
      "enum": [
       "list",
       "grid",
       "featured_then_list"
      ],
      "default": "featured_then_list"
     },
     "density": {
      "type": "string",
      "enum": [
       "comfortable",
       "compact"
      ],
      "default": "comfortable"
     },
     "tabs": {
      "type": "array",
      "maxItems": 6,
      "uniqueItems": true,
      "items": {
       "type": "string",
       "enum": [
        "for_you",
        "games",
        "apps",
        "quick",
        "surveys",
        "my_offers"
       ]
      },
      "description": "Tabs in this order. my_offers is always added. surveys only on mixed placements"
     },
     "default_sort": {
      "type": "string",
      "enum": [
       "for_you",
       "reward",
       "newest",
       "quickest"
      ],
      "default": "for_you",
      "description": "Order when the wall opens; the user can still change it"
     },
     "show_header": {
      "type": "boolean",
      "default": true,
      "description": "Off when the publisher draws its own header around the iframe"
     },
     "back_action": {
      "type": "string",
      "enum": [
       "none",
       "close_event",
       "url"
      ],
      "default": "close_event"
     },
     "back_url": {
      "type": [
       "string",
       "null"
      ],
      "format": "uri",
      "maxLength": 2048,
      "description": "https only (never javascript: or data:). Required when back_action is url, refused otherwise"
     }
    }
   },
   "PlacementInput": {
    "type": "object",
    "required": [
     "property_id",
     "kind",
     "name",
     "currency"
    ],
    "additionalProperties": false,
    "properties": {
     "property_id": {
      "$ref": "#/components/schemas/PropertyId"
     },
     "kind": {
      "$ref": "#/components/schemas/PlacementKind"
     },
     "name": {
      "type": "string",
      "maxLength": 80
     },
     "currency": {
      "$ref": "#/components/schemas/Currency"
     },
     "theme": {
      "$ref": "#/components/schemas/WallTheme"
     },
     "allowed_origins": {
      "type": "array",
      "items": {
       "type": "string",
       "format": "uri"
      }
     },
     "launch_mode": {
      "$ref": "#/components/schemas/LaunchMode"
     },
     "ranking_style": {
      "type": "string",
      "enum": [
       "max_revenue",
       "balanced",
       "user_friendly"
      ],
      "default": "balanced"
     },
     "screenout_reward": {
      "type": "object",
      "properties": {
       "enabled": {
        "type": "boolean",
        "default": false
       },
       "amount": {
        "$ref": "#/components/schemas/DecimalString"
       }
      },
      "description": "Off by default; funded from the publisher's own earnings (Q-09)"
     }
    }
   },
   "PlacementUpdate": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 80
     },
     "currency": {
      "$ref": "#/components/schemas/Currency"
     },
     "theme": {
      "$ref": "#/components/schemas/WallTheme"
     },
     "allowed_origins": {
      "type": "array",
      "items": {
       "type": "string",
       "format": "uri"
      }
     },
     "launch_mode": {
      "$ref": "#/components/schemas/LaunchMode"
     },
     "ranking_style": {
      "type": "string",
      "enum": [
       "max_revenue",
       "balanced",
       "user_friendly"
      ]
     },
     "screenout_reward": {
      "type": "object",
      "properties": {
       "enabled": {
        "type": "boolean"
       },
       "amount": {
        "$ref": "#/components/schemas/DecimalString"
       }
      }
     },
     "min_age": {
      "type": [
       "integer",
       "null"
      ],
      "enum": [
       13,
       16,
       18,
       null
      ],
      "description": "Your own minimum age for this wall. The wall uses the higher of this and the minimum age where the user is (13 or 16); null = that minimum only."
     }
    }
   },
   "Placement": {
    "type": "object",
    "required": [
     "id",
     "public_id",
     "property_id",
     "kind",
     "name",
     "status",
     "currency"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/PlacementId"
     },
     "public_id": {
      "$ref": "#/components/schemas/SubSourceId"
     },
     "property_id": {
      "$ref": "#/components/schemas/PropertyId"
     },
     "kind": {
      "$ref": "#/components/schemas/PlacementKind"
     },
     "name": {
      "type": "string"
     },
     "status": {
      "$ref": "#/components/schemas/PlacementStatus"
     },
     "currency": {
      "$ref": "#/components/schemas/Currency"
     },
     "theme": {
      "$ref": "#/components/schemas/WallTheme"
     },
     "allowed_origins": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "launch_mode": {
      "$ref": "#/components/schemas/LaunchMode"
     },
     "ranking_style": {
      "type": "string",
      "enum": [
       "max_revenue",
       "balanced",
       "user_friendly"
      ]
     },
     "screenout_reward": {
      "type": "object",
      "properties": {
       "enabled": {
        "type": "boolean"
       },
       "amount": {
        "type": [
         "string",
         "null"
        ]
       }
      }
     },
     "go_live_requirements": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "key": {
         "type": "string",
         "enum": [
          "postback_acknowledged",
          "signed_launch_verified"
         ]
        },
        "done": {
         "type": "boolean"
        }
       }
      }
     },
     "min_age": {
      "type": [
       "integer",
       "null"
      ],
      "enum": [
       13,
       16,
       18,
       null
      ],
      "description": "Your own minimum age for this wall, or null"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "PlacementPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Placement"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "CurrencySaleInput": {
    "type": "object",
    "required": [
     "multiplier",
     "starts_at",
     "ends_at"
    ],
    "additionalProperties": false,
    "properties": {
     "multiplier": {
      "type": "string",
      "pattern": "^[0-9]{1,2}(\\.[0-9]{1,3})?$",
      "description": "Above 1 and at most 10, e.g. \"1.5\""
     },
     "starts_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "ends_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "countries": {
      "type": "array",
      "maxItems": 50,
      "uniqueItems": true,
      "items": {
       "$ref": "#/components/schemas/Country"
      },
      "description": "Empty or left out: every country"
     },
     "label": {
      "type": [
       "string",
       "null"
      ],
      "minLength": 1,
      "maxLength": 40,
      "description": "Shown on the wall as plain text; no < > or links"
     }
    }
   },
   "CurrencySale": {
    "type": "object",
    "required": [
     "id",
     "placement_id",
     "multiplier",
     "starts_at",
     "ends_at",
     "countries",
     "label",
     "status",
     "created_at"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^sale_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "placement_id": {
      "$ref": "#/components/schemas/PlacementId"
     },
     "multiplier": {
      "type": "string",
      "description": "e.g. \"1.500\""
     },
     "starts_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "ends_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "countries": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Country"
      }
     },
     "label": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "scheduled",
       "live",
       "ended"
      ],
      "description": "scheduled until starts_at, live until ends_at, then ended"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "PublisherIntegration": {
    "type": "object",
    "required": [
     "placement_id",
     "snippets",
     "postback",
     "egress_ips"
    ],
    "properties": {
     "placement_id": {
      "$ref": "#/components/schemas/PlacementId"
     },
     "snippets": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "stack",
        "code"
       ],
       "properties": {
        "stack": {
         "type": "string",
         "enum": [
          "web_iframe",
          "web_js",
          "android_sdk",
          "headless_api",
          "php_server",
          "ts_server"
         ]
        },
        "language": {
         "type": "string",
         "enum": [
          "typescript",
          "php",
          "html",
          "javascript",
          "kotlin"
         ]
        },
        "code": {
         "type": "string",
         "description": "Plain text to copy; placeholders only, never a key"
        }
       }
      }
     },
     "signed_launch": {
      "type": "object",
      "properties": {
       "params": {
        "type": "array",
        "items": {
         "type": "string"
        },
        "description": "The values each wall link carries, signed (sdk.md 2.1)"
       },
       "algorithm": {
        "const": "HMAC-SHA256"
       },
       "doc_url": {
        "type": "string",
        "format": "uri",
        "description": "Always a page on https://docs.krin.io"
       }
      }
     },
     "postback": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "$ref": "#/components/schemas/PostbackConfig"
       }
      ],
      "description": "As publisher.postback.get answers it, except that a part of url_template shaped like a secret (32 or more base64url or hex characters that are not an id) shows as ***. A shorter token is not masked: the mask is a safety net, not a promise"
     },
     "egress_ips": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "description": "KRIN's static egress IPs for postbacks, to allowlist. Empty until the egress relay sends every reward postback: check each postback's signature instead"
     }
    }
   },
   "PostbackMacro": {
    "type": "string",
    "description": "Macros available in publisher postback templates. Net and reward only.",
    "enum": [
     "{conversion_id}",
     "{click_id}",
     "{user_id}",
     "{placement_id}",
     "{offer_id}",
     "{offer_name}",
     "{event_key}",
     "{event_name}",
     "{payout_usd}",
     "{payout_micros}",
     "{reward}",
     "{currency}",
     "{status}",
     "{kind}",
     "{ip}",
     "{country}",
     "{ts}",
     "{test}",
     "{launch}",
     "{sig}"
    ]
   },
   "PostbackConfigInput": {
    "type": "object",
    "required": [
     "url_template"
    ],
    "additionalProperties": false,
    "properties": {
     "url_template": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "description": "GET: URL with macros; it must contain {sig} {ts} {conversion_id} {kind} {user_id} {reward} {payout_micros} {test}, else 422 postback_template_unsigned. POST: the URL receives the signed JSON body."
     },
     "method": {
      "type": "string",
      "enum": [
       "get",
       "post"
      ],
      "default": "get"
     },
     "preset": {
      "type": [
       "string",
       "null"
      ],
      "description": "Compatibility preset id (publisher.postback_presets.list)"
     },
     "send_holds": {
      "type": "boolean",
      "default": false,
      "description": "Also send hold and decline. Credits and reversals are always sent."
     }
    }
   },
   "PostbackConfig": {
    "allOf": [
     {
      "$ref": "#/components/schemas/PostbackConfigInput"
     },
     {
      "type": "object",
      "properties": {
       "acknowledged_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time",
        "description": "Last 2xx test since the URL, method or preset last changed; null = test again before go-live"
       },
       "last_status": {
        "type": [
         "integer",
         "null"
        ],
        "description": "HTTP status of the last test postback"
       },
       "last_tested_at": {
        "type": [
         "string",
         "null"
        ],
        "format": "date-time"
       }
      }
     }
    ]
   },
   "PostbackTestResult": {
    "description": "One test postback (publisher.postback.test). The publisher's server saw the same delivery id in X-Krin-Delivery.",
    "allOf": [
     {
      "$ref": "#/components/schemas/DeliveryAttempt"
     },
     {
      "type": "object",
      "required": [
       "delivery_id",
       "acknowledged"
      ],
      "properties": {
       "delivery_id": {
        "$ref": "#/components/schemas/DeliveryId"
       },
       "acknowledged": {
        "type": "boolean",
        "description": "true when the answer was 2xx: go-live requirement postback_acknowledged is done"
       },
       "egress": {
        "type": [
         "string",
         "null"
        ],
        "enum": [
         "relay",
         "direct",
         null
        ],
        "description": "relay = from the two static egress IPs; direct = from Cloudflare (until the relay is bound); null on a dry run"
       }
      }
     }
    ]
   },
   "PostbackPreset": {
    "type": "object",
    "required": [
     "id",
     "name",
     "macro_map",
     "source_url",
     "checked_on",
     "notes",
     "note_codes"
    ],
    "description": "Only names change: the values, the net-only rule and the KRIN signature stay, so the server checks sig as 2.3 says. Every preset names all the signed values; a KRIN macro the network has no name for keeps its KRIN name. A GET template is the URL plus name={macro} for each entry. No preset sends {ip}; add it only if your server uses it.",
    "properties": {
     "id": {
      "type": "string",
      "description": "Use as PostbackConfigInput.preset"
     },
     "name": {
      "type": "string"
     },
     "macro_map": {
      "type": "object",
      "additionalProperties": {
       "$ref": "#/components/schemas/PostbackMacro"
      },
      "description": "Parameter name used by that network's format -> KRIN macro"
     },
     "source_url": {
      "type": [
       "string",
       "null"
      ],
      "format": "uri",
      "description": "The network's public publisher docs the names were taken from; null for KRIN's own preset. A plain link: KRIN never fetches it"
     },
     "checked_on": {
      "type": [
       "string",
       "null"
      ],
      "format": "date",
      "description": "When KRIN last read those docs"
     },
     "notes": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      },
      "description": "Parameters your server must handle differently: ones KRIN does not send (with what to read instead) and the one that carries KRIN's signature"
     },
     "note_codes": {
      "type": "object",
      "additionalProperties": {
       "$ref": "#/components/schemas/PostbackPresetNoteCode"
      },
      "description": "The same parameters as notes, each with a stable code for a translated note; notes holds the English text. user_id_as names the parameter that carries your user id (the macro_map entry for {user_id})"
     }
    }
   },
   "PostbackPresetNoteCode": {
    "type": "string",
    "enum": [
     "ip_optional",
     "money_unsigned",
     "reverse_in_kind",
     "user_id_as",
     "sig_krin"
    ],
    "description": "ip_optional = not sent unless you add ip={ip}; money_unsigned = a USD amount is not sent (use payout_micros, signed); reverse_in_kind = not sent, read kind; user_id_as = not sent, your user id comes in another parameter; sig_krin = carries the KRIN signature"
   },
   "SecretOnce": {
    "type": "object",
    "required": [
     "secret",
     "previous_valid_until"
    ],
    "properties": {
     "secret": {
      "type": "string",
      "description": "Shown once"
     },
     "previous_valid_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "DemandFilters": {
    "type": "object",
    "additionalProperties": false,
    "description": "One placement's demand filters. [] means no filter of that kind: every offer type, every category, every advertiser. offer_types, categories and advertiser_allow each show only offers that match one entry (kinds combine with AND). A block or a hidden offer always wins; a pin never brings a hidden offer back.",
    "properties": {
     "offer_types": {
      "type": "array",
      "maxItems": 8,
      "items": {
       "$ref": "#/components/schemas/OfferType"
      }
     },
     "categories": {
      "type": "array",
      "maxItems": 50,
      "items": {
       "type": "string",
       "minLength": 1,
       "maxLength": 80
      },
      "description": "Offer categories (an offer's vertical, such as games or finance), matched exactly"
     },
     "advertiser_allow": {
      "type": "array",
      "maxItems": 200,
      "items": {
       "$ref": "#/components/schemas/AdvertiserPublicId"
      }
     },
     "advertiser_block": {
      "type": "array",
      "maxItems": 500,
      "items": {
       "$ref": "#/components/schemas/AdvertiserPublicId"
      },
      "description": "Advertisers blocked on this placement only"
     },
     "advertiser_block_all": {
      "type": "array",
      "readOnly": true,
      "items": {
       "$ref": "#/components/schemas/AdvertiserPublicId"
      },
      "description": "Advertisers blocked on every placement (advertiser-blocks without placement_id). Read-only: a PUT ignores it"
     },
     "hidden_offers": {
      "type": "array",
      "maxItems": 500,
      "items": {
       "$ref": "#/components/schemas/OfferId"
      }
     },
     "pinned_offers": {
      "type": "array",
      "maxItems": 10,
      "items": {
       "$ref": "#/components/schemas/OfferId"
      },
      "description": "Shown first, in this order, when they rank on the wall"
     },
     "min_conversion_rate": {
      "type": [
       "number",
       "null"
      ],
      "minimum": 0,
      "maximum": 1,
      "description": "Not offered yet: always null. A PUT with a number answers 400"
     },
     "ranking_style": {
      "type": "string",
      "enum": [
       "max_revenue",
       "balanced",
       "user_friendly"
      ],
      "description": "Left out of a PUT: unchanged"
     }
    }
   },
   "DeliveryStatus": {
    "type": "string",
    "enum": [
     "queued",
     "retrying",
     "delivered",
     "failed"
    ]
   },
   "DeliveryAttempt": {
    "type": "object",
    "required": [
     "at",
     "http_status",
     "latency_ms"
    ],
    "properties": {
     "at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "http_status": {
      "type": [
       "integer",
       "null"
      ]
     },
     "latency_ms": {
      "type": "integer"
     },
     "error": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "timeout",
       "dns",
       "tls",
       "connection_refused",
       "body_too_large",
       "redirect",
       "blocked_address",
       "egress_unavailable",
       "not_configured",
       "signing_failed",
       null
      ],
      "description": "Set when no HTTP status came back (not_configured and signing_failed are KRIN-side, from the delivery runtime). blocked_address = the host resolved to a non-public address or is not allowed; a 3xx is a status (redirects are not followed)"
     },
     "signature_failed_hint": {
      "type": "boolean"
     },
     "request_url": {
      "type": "string",
      "description": "Secret parameters masked. Present once the delivery runtime records it"
     },
     "response_excerpt": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 512
     }
    }
   },
   "DeliveryId": {
    "type": "string",
    "pattern": "^dlv_[0-7][0-9a-hjkmnp-tv-z]{25}$",
    "description": "One reward postback delivery (sent as X-Krin-Delivery)"
   },
   "Delivery": {
    "type": "object",
    "required": [
     "id",
     "conversion_id",
     "kind",
     "status",
     "attempts"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/DeliveryId"
     },
     "conversion_id": {
      "$ref": "#/components/schemas/ConversionId"
     },
     "kind": {
      "type": "string",
      "enum": [
       "credit",
       "reverse",
       "hold",
       "decline"
      ],
      "description": "credit and reverse; hold and decline when the placement sends holds (postbacks.md, delivery runtime)"
     },
     "status": {
      "$ref": "#/components/schemas/DeliveryStatus"
     },
     "replay_of": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/DeliveryId"
       },
       {
        "type": "null"
       }
      ]
     },
     "attempts": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/DeliveryAttempt"
      }
     },
     "next_attempt_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "DeliveryPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Delivery"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "DeliveryHealth": {
    "type": "object",
    "required": [
     "success_rate",
     "p95_latency_ms",
     "failing",
     "top_errors",
     "from",
     "to"
    ],
    "description": "Deliveries created in [from, to) (default the last 24 hours)",
    "properties": {
     "placement_id": {
      "$ref": "#/components/schemas/PlacementId",
      "description": "The placement these numbers are for: present when the read was filtered by placement, and in delivery.failing (raised per placement)"
     },
     "success_rate": {
      "type": [
       "number",
       "null"
      ],
      "minimum": 0,
      "maximum": 1,
      "description": "delivered / (delivered + failed); null while no delivery in the range has finished"
     },
     "p95_latency_ms": {
      "type": [
       "integer",
       "null"
      ],
      "description": "Slowest 5% of attempts answered within this; null with no timed attempt"
     },
     "failing": {
      "type": "integer",
      "description": "Deliveries in the range now retrying or failed"
     },
     "top_errors": {
      "type": "array",
      "maxItems": 5,
      "items": {
       "type": "object",
       "required": [
        "error",
        "count"
       ],
       "properties": {
        "error": {
         "type": "string"
        },
        "count": {
         "type": "integer"
        }
       }
      }
     },
     "from": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "to": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "ReplayInput": {
    "type": "object",
    "additionalProperties": false,
    "description": "Either ids, or both from and to (when the original deliveries were created). status picks by each delivery's latest send: delivered or failed (failed when left out of a range; with ids both are replayed unless status names one).",
    "properties": {
     "ids": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1000,
      "items": {
       "$ref": "#/components/schemas/DeliveryId"
      }
     },
     "from": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "to": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "status": {
      "type": "string",
      "enum": [
       "delivered",
       "failed"
      ]
     }
    }
   },
   "PublisherOfferEvent": {
    "type": "object",
    "required": [
     "seq",
     "name",
     "net_payout_micros"
    ],
    "properties": {
     "seq": {
      "type": "integer"
     },
     "name": {
      "type": "string"
     },
     "net_payout_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "time_limit_hours": {
      "type": [
       "integer",
       "null"
      ]
     },
     "repeatable": {
      "type": "boolean"
     }
    }
   },
   "PublisherOffer": {
    "type": "object",
    "required": [
     "id",
     "type",
     "title",
     "advertiser",
     "platforms",
     "countries",
     "events",
     "total_net_micros",
     "reversal_window_days",
     "is_private"
    ],
    "description": "What a publisher sees about an offer: its net payout per event and its declared reversal window.",
    "properties": {
     "id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "type": {
      "$ref": "#/components/schemas/OfferType"
     },
     "title": {
      "type": "string"
     },
     "advertiser": {
      "$ref": "#/components/schemas/AdvertiserRef"
     },
     "icon_url": {
      "type": [
       "string",
       "null"
      ]
     },
     "platforms": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Platform"
      }
     },
     "countries": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Country"
      },
      "description": "Countries the offer targets. [] = no country targeting"
     },
     "events": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/PublisherOfferEvent"
      }
     },
     "total_net_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg",
      "description": "Sum of every event's net payout, each counted once"
     },
     "reversal_window_days": {
      "type": "integer"
     },
     "is_private": {
      "type": "boolean"
     }
    }
   },
   "PublisherOfferPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/PublisherOffer"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PublisherConversion": {
    "type": "object",
    "required": [
     "id",
     "offer_id",
     "event_name",
     "user_id",
     "placement_id",
     "status",
     "status_label",
     "event_at"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/ConversionId"
     },
     "click_id": {
      "$ref": "#/components/schemas/ClickId"
     },
     "offer_id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "offer_title": {
      "type": "string"
     },
     "event_name": {
      "type": "string"
     },
     "user_id": {
      "type": "string",
      "description": "The publisher's own user id"
     },
     "placement_id": {
      "$ref": "#/components/schemas/PlacementId"
     },
     "net_micros": {
      "type": [
       "integer",
       "null"
      ],
      "format": "int64"
     },
     "reward": {
      "type": [
       "string",
       "null"
      ],
      "description": "User reward in the placement currency"
     },
     "currency": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "$ref": "#/components/schemas/ConversionStatus"
     },
     "status_label": {
      "type": "string"
     },
     "status_reason_code": {
      "type": [
       "string",
       "null"
      ],
      "description": "Publisher_code only (state-machines.yaml reason_codes.conversion.<code>.publisher_code); a concealed code reads under_review or not_credited, never itself"
     },
     "publisher_code": {
      "type": [
       "string",
       "null"
      ],
      "description": "The same value as status_reason_code: the publisher code"
     },
     "held_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "While held: when the hold ends. Under under_review it is the date the conversion must be decided by (received + the offer's reversal window), never a KRIN rule's own hold length"
     },
     "event_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "settles_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "PublisherConversionPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/PublisherConversion"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PublisherReversal": {
    "type": "object",
    "required": [
     "id",
     "conversion_id",
     "reason_code",
     "filed_at",
     "net_deducted_micros",
     "inside_window"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rev_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "conversion_id": {
      "$ref": "#/components/schemas/ConversionId"
     },
     "reason_code": {
      "type": "string",
      "description": "Reason_codes.reversal.<code>.publisher_code; the advertiser's fraud and terms codes read advertiser_quality_review"
     },
     "publisher_code": {
      "type": "string",
      "description": "The same value as reason_code: the publisher code"
     },
     "evidence_summary": {
      "type": "string",
      "maxLength": 500,
      "description": "The advertiser's summary, as plain text. Absent under advertiser_quality_review"
     },
     "actor": {
      "$ref": "#/components/schemas/ActorRef"
     },
     "filed_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "net_deducted_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "inside_window": {
      "const": true,
      "description": "Always true; the window is enforced by the database"
     }
    }
   },
   "PublisherReversalPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/PublisherReversal"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PublisherEndUser": {
    "type": "object",
    "required": [
     "user_id",
     "placement_id",
     "totals"
    ],
    "properties": {
     "user_id": {
      "type": "string"
     },
     "placement_id": {
      "$ref": "#/components/schemas/PlacementId"
     },
     "first_seen_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "totals": {
      "type": "object",
      "properties": {
       "credited_reward": {
        "type": "string"
       },
       "net_micros": {
        "type": "integer",
        "format": "int64"
       },
       "conversions": {
        "type": "integer"
       }
      }
     },
     "holds": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "conversion_id": {
         "type": "string"
        },
        "reason_code": {
         "type": "string",
         "description": "The publisher code: under_review or not_credited for a concealed hold; a code that is not concealed keeps its own name. Never the internal code behind a concealed one"
        },
        "release_at": {
         "type": [
          "string",
          "null"
         ],
         "format": "date-time",
         "description": "When the hold ends. A hold that reads under_review shows the date the conversion must be decided by (received + the offer's reversal window), never a KRIN rule's own hold length"
        }
       }
      }
     },
     "open_claims": {
      "type": "integer"
     }
    }
   },
   "TimelineItem": {
    "type": "object",
    "required": [
     "at",
     "kind",
     "text"
    ],
    "properties": {
     "at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "kind": {
      "type": "string",
      "enum": [
       "wall_open",
       "click",
       "event",
       "reward",
       "hold",
       "release",
       "reject",
       "reversal",
       "decision",
       "claim",
       "delivery"
      ]
     },
     "text": {
      "type": "string",
      "description": "Plain-language line, redacted per the rule's disclosure level"
     },
     "ref": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   },
   "UserTimelinePage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/TimelineItem"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "ClaimStatus": {
    "type": "string",
    "enum": [
     "open",
     "auto_credited",
     "auto_declined",
     "awaiting_advertiser",
     "credited",
     "declined"
    ]
   },
   "Claim": {
    "type": "object",
    "required": [
     "id",
     "click_id",
     "status",
     "created_at"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/ClaimId"
     },
     "click_id": {
      "$ref": "#/components/schemas/ClickId"
     },
     "user_id": {
      "type": "string"
     },
     "event_name": {
      "type": "string"
     },
     "status": {
      "$ref": "#/components/schemas/ClaimStatus"
     },
     "decision_reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "advertiser_due_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "ClaimPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Claim"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PublisherBalance": {
    "type": "object",
    "required": [
     "pending_micros",
     "available_micros",
     "payable_micros",
     "net_days",
     "min_payout_micros"
    ],
    "properties": {
     "pending_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "available_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "payable_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "next_statement": {
      "type": [
       "object",
       "null"
      ],
      "description": "The statement for the month in progress (UTC): earnings available now, in whole cents. Below min_payout_micros it rolls over",
      "properties": {
       "period_end": {
        "type": "string",
        "format": "date"
       },
       "due_date": {
        "type": "string",
        "format": "date"
       },
       "estimated_micros": {
        "type": "integer",
        "format": "int64"
       }
      }
     },
     "net_days": {
      "type": "integer",
      "enum": [
       15,
       30
      ]
     },
     "min_payout_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     }
    }
   },
   "Statement": {
    "type": "object",
    "required": [
     "id",
     "period_start",
     "period_end",
     "due_date",
     "amount_micros",
     "status"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^stm_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "period_start": {
      "type": "string",
      "format": "date"
     },
     "period_end": {
      "type": "string",
      "format": "date"
     },
     "net_days": {
      "type": "integer"
     },
     "due_date": {
      "type": "string",
      "format": "date"
     },
     "amount_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "withheld_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg",
      "description": "Part of this statement frozen by an open case (publisher.cases); paid = amount - withheld"
     },
     "status": {
      "type": "string",
      "enum": [
       "issued",
       "rolled_over",
       "held",
       "paid"
      ]
     },
     "hold_reason_code": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "kyb_incomplete",
       "network_unverified",
       "payout_destination_cooling",
       "promotion_violation",
       "sanctions_hit",
       null
      ],
      "description": "Why a held statement waits (state-machines.yaml reason_codes.payout); null unless status is held"
     },
     "paid_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "StatementPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Statement"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PayoutMethod": {
    "type": "object",
    "required": [
     "kind",
     "display_hint",
     "status"
    ],
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^dest_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "kind": {
      "type": "string",
      "enum": [
       "wire",
       "paypal",
       "payoneer",
       "wise",
       "usdt"
      ]
     },
     "display_hint": {
      "type": "string",
      "description": "Masked, e.g. \"Wise ****1234\""
     },
     "status": {
      "type": "string",
      "enum": [
       "cooling",
       "active",
       "retired"
      ]
     },
     "cooling_until": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "pending_change": {
      "description": "A new destination still in its 72-hour cooling period while this one is active",
      "oneOf": [
       {
        "$ref": "#/components/schemas/PayoutMethod"
       },
       {
        "type": "null"
       }
      ]
     }
    }
   },
   "PayoutMethodInput": {
    "type": "object",
    "required": [
     "kind",
     "details",
     "reason"
    ],
    "additionalProperties": false,
    "properties": {
     "kind": {
      "type": "string",
      "enum": [
       "wire",
       "paypal",
       "payoneer",
       "wise",
       "usdt"
      ],
      "description": "The kinds KRIN offers now (400 at /kind for one that is not offered yet)"
     },
     "details": {
      "description": "The details of the kind: wire = PayoutWireDetails; paypal, payoneer and wise = PayoutEmailDetails; usdt = PayoutUsdtDetails. Sealed at rest; never returned, logged or emailed",
      "oneOf": [
       {
        "$ref": "#/components/schemas/PayoutWireDetails"
       },
       {
        "$ref": "#/components/schemas/PayoutEmailDetails"
       },
       {
        "$ref": "#/components/schemas/PayoutUsdtDetails"
       }
      ]
     },
     "reason": {
      "type": "string",
      "minLength": 1,
      "maxLength": 500,
      "description": "Why the payout method changes (kept in the audit log)"
     }
    }
   },
   "PayoutWireDetails": {
    "type": "object",
    "required": [
     "account_holder",
     "bank_name"
    ],
    "additionalProperties": false,
    "description": "Either iban (its check digits are verified), or account_number with swift_bic (and routing_number for a US bank)",
    "properties": {
     "account_holder": {
      "type": "string",
      "minLength": 2,
      "maxLength": 140
     },
     "bank_name": {
      "type": "string",
      "minLength": 2,
      "maxLength": 140
     },
     "iban": {
      "type": "string",
      "maxLength": 42
     },
     "account_number": {
      "type": "string",
      "maxLength": 40
     },
     "swift_bic": {
      "type": "string",
      "pattern": "^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$"
     },
     "routing_number": {
      "type": "string",
      "pattern": "^[0-9]{9}$",
      "description": "ABA routing number; its checksum is verified"
     },
     "bank_country": {
      "type": "string",
      "pattern": "^[A-Z]{2}$"
     }
    }
   },
   "PayoutEmailDetails": {
    "type": "object",
    "required": [
     "email"
    ],
    "additionalProperties": false,
    "properties": {
     "email": {
      "type": "string",
      "format": "email",
      "maxLength": 254,
      "description": "The email address of the PayPal, Payoneer or Wise account"
     }
    }
   },
   "PayoutUsdtDetails": {
    "type": "object",
    "required": [
     "network",
     "address"
    ],
    "additionalProperties": false,
    "properties": {
     "network": {
      "type": "string",
      "enum": [
       "trc20",
       "erc20"
      ]
     },
     "address": {
      "type": "string",
      "maxLength": 64,
      "description": "trc20: a TRON address (base58check verified); erc20: a 0x address (EIP-55 checksum verified when mixed case)"
     }
    }
   },
   "PayoutStopInput": {
    "type": "object",
    "required": [
     "token"
    ],
    "additionalProperties": false,
    "properties": {
     "token": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{43}$",
      "description": "The part after # in the Stop link of a payout method email"
     }
    }
   },
   "PayoutStopPreview": {
    "type": "object",
    "required": [
     "waiting",
     "org"
    ],
    "properties": {
     "waiting": {
      "type": "boolean",
      "description": "false when no change waits any more: it is already active, or someone stopped it"
     },
     "org": {
      "type": "string"
     },
     "method": {
      "type": "string",
      "description": "The masked new method (display_hint)"
     },
     "old_method": {
      "type": [
       "string",
       "null"
      ],
      "description": "The masked method payments go to now; null when this is the first one"
     },
     "actor": {
      "type": [
       "string",
       "null"
      ],
      "description": "Who added the new method"
     },
     "added_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "active_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "PayoutStopDone": {
    "type": "object",
    "required": [
     "stopped"
    ],
    "properties": {
     "stopped": {
      "type": "boolean",
      "const": true
     }
    }
   },
   "TaxForm": {
    "type": "object",
    "required": [
     "id",
     "kind",
     "status"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "kind": {
      "type": "string",
      "enum": [
       "w9",
       "w8ben",
       "w8bene"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "submitted",
       "accepted",
       "rejected"
      ]
     },
     "submitted_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "TaxFormInput": {
    "type": "object",
    "required": [
     "kind",
     "upload_id"
    ],
    "additionalProperties": false,
    "properties": {
     "kind": {
      "type": "string",
      "enum": [
       "w9",
       "w8ben",
       "w8bene"
      ]
     },
     "upload_id": {
      "type": "string"
     }
    }
   },
   "RewardPostback": {
    "type": "object",
    "required": [
     "kind",
     "conversion_id",
     "click_id",
     "user_id",
     "placement_id",
     "offer_id",
     "event_key",
     "payout_micros",
     "payout_usd",
     "reward",
     "currency",
     "status",
     "ts"
    ],
    "description": "Outbound reward postback. payout_* is the publisher's NET.",
    "properties": {
     "kind": {
      "type": "string",
      "enum": [
       "credit",
       "reverse",
       "hold",
       "decline"
      ],
      "description": "credit and reverse always; hold and decline (a held conversion that was not credited) only with send_holds"
     },
     "conversion_id": {
      "$ref": "#/components/schemas/ConversionId"
     },
     "click_id": {
      "$ref": "#/components/schemas/ClickId"
     },
     "user_id": {
      "type": "string"
     },
     "placement_id": {
      "type": "string"
     },
     "offer_id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "offer_name": {
      "type": "string"
     },
     "event_key": {
      "type": "string"
     },
     "event_name": {
      "type": "string"
     },
     "payout_micros": {
      "type": "integer",
      "format": "int64"
     },
     "payout_usd": {
      "$ref": "#/components/schemas/DecimalString"
     },
     "reward": {
      "$ref": "#/components/schemas/DecimalString"
     },
     "currency": {
      "type": "string"
     },
     "status": {
      "$ref": "#/components/schemas/ConversionStatus"
     },
     "reason_code": {
      "type": [
       "string",
       "null"
      ],
      "description": "Publisher_code only (under_review / not_credited for a concealed hold or decline, advertiser_quality_review for an accusing reversal)"
     },
     "ip": {
      "type": [
       "string",
       "null"
      ]
     },
     "country": {
      "type": [
       "string",
       "null"
      ]
     },
     "ts": {
      "type": "integer"
     },
     "test": {
      "type": "boolean",
      "description": "true for publisher.postback.test and sandbox conversions; never credit a user for it"
     },
     "launch": {
      "type": "string",
      "enum": [
       "signed",
       "unsigned",
       "headless"
      ],
      "description": "How the user's wall session was opened: signed (your server signed the launch), unsigned (a public web wall: anyone can choose the user id, so check the user on your side) or headless (your server, with its API key). Signed with the POST body; in a GET template {launch} is outside the signature. Treat a missing value as unsigned."
     }
    }
   },
   "CaseId": {
    "type": "string",
    "pattern": "^case_[0-7][0-9a-hjkmnp-tv-z]{25}$",
    "description": "Fraud case. The publisher sees its own cases; an advertiser sees the id on a recovery credit."
   },
   "PublisherCaseState": {
    "type": "string",
    "enum": [
     "under_review",
     "decided",
     "appealed",
     "closed"
    ],
    "description": "open and awaiting_approval both show as under_review (state-machines.yaml fraud_case.publisher_label)"
   },
   "PublisherCase": {
    "type": "object",
    "required": [
     "id",
     "state",
     "opened_reason_code",
     "opened_reason",
     "opened_at",
     "withheld_micros",
     "released_micros",
     "forfeited_micros",
     "can_appeal"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/CaseId"
     },
     "state": {
      "$ref": "#/components/schemas/PublisherCaseState"
     },
     "opened_reason_code": {
      "type": "string",
      "description": "state-machines.yaml reason_codes.publisher_case"
     },
     "opened_reason": {
      "type": "string"
     },
     "opened_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "summary": {
      "type": [
       "string",
       "null"
      ],
      "description": "What KRIN Ops wrote to you when the case opened"
     },
     "scope_sub_ids": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "$ref": "#/components/schemas/SubSourceId"
      },
      "description": "Placements under review; null means the whole account"
     },
     "verdict": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "confirmed",
       "partial",
       "cleared",
       null
      ]
     },
     "verdict_reason_code": {
      "type": [
       "string",
       "null"
      ],
      "description": "state-machines.yaml reason_codes.fraud_case_verdict"
     },
     "verdict_reason": {
      "type": [
       "string",
       "null"
      ]
     },
     "verdict_sub_ids": {
      "type": [
       "array",
       "null"
      ],
      "items": {
       "$ref": "#/components/schemas/SubSourceId"
      },
      "description": "Placements a partial verdict confirmed"
     },
     "appeal_deadline": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "can_appeal": {
      "type": "boolean"
     },
     "appeal_filed_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "appeal_decided_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "release_due_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "With no verdict by then the withheld earnings are released"
     },
     "closed_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "withheld_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "released_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "forfeited_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "late_conversions_withheld": {
      "type": "integer",
      "minimum": 0,
      "description": "Conversions that arrived on a paused placement after the verdict (clicks made before it), withheld into this case while the verdict can still change"
     },
     "late_conversions_released": {
      "type": "integer",
      "minimum": 0,
      "description": "Late conversions approved as normal after the verdict was overturned"
     },
     "late_conversions_rejected": {
      "type": "integer",
      "minimum": 0,
      "description": "Late conversions not credited because the verdict stands (reason placement_fraud_confirmed)"
     }
    }
   },
   "PublisherCaseConversion": {
    "type": "object",
    "required": [
     "conversion_id",
     "sub_id",
     "amount_micros",
     "state",
     "frozen_at"
    ],
    "properties": {
     "conversion_id": {
      "$ref": "#/components/schemas/ConversionId"
     },
     "sub_id": {
      "$ref": "#/components/schemas/SubSourceId"
     },
     "amount_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "state": {
      "$ref": "#/components/schemas/PublisherCaseHoldState"
     },
     "frozen_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "closed_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     }
    }
   },
   "PublisherCaseHoldState": {
    "type": "string",
    "enum": [
     "frozen",
     "released",
     "forfeited",
     "reversed"
    ]
   },
   "PublisherCaseEvent": {
    "type": "object",
    "required": [
     "kind",
     "at"
    ],
    "properties": {
     "kind": {
      "type": "string",
      "enum": [
       "opened",
       "frozen",
       "extended",
       "decided",
       "placements_paused",
       "appeal_filed",
       "appeal_decided",
       "closed",
       "released",
       "forfeited",
       "reversed",
       "placements_resumed",
       "late_conversions_released",
       "late_conversions_rejected"
      ]
     },
     "at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "sub_ids": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/SubSourceId"
      },
      "description": "placements_paused / placements_resumed: the placements a verdict paused, or that an overturned verdict put back live. late_conversions_released / late_conversions_rejected: the placement whose late conversions were settled (with conversions = how many)"
     },
     "amount_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "conversions": {
      "type": "integer",
      "minimum": 0
     },
     "verdict": {
      "type": "string",
      "enum": [
       "confirmed",
       "partial",
       "cleared"
      ]
     },
     "reason_code": {
      "type": "string"
     },
     "appeal_deadline": {
      "type": "string",
      "format": "date-time"
     },
     "release_due_at": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "PublisherCaseDetail": {
    "allOf": [
     {
      "$ref": "#/components/schemas/PublisherCase"
     },
     {
      "type": "object",
      "required": [
       "conversions",
       "events"
      ],
      "properties": {
       "conversions": {
        "type": "array",
        "items": {
         "$ref": "#/components/schemas/PublisherCaseConversion"
        }
       },
       "events": {
        "type": "array",
        "items": {
         "$ref": "#/components/schemas/PublisherCaseEvent"
        }
       }
      }
     }
    ]
   },
   "PublisherCasePage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/PublisherCase"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PublisherAppealInput": {
    "type": "object",
    "required": [
     "statement"
    ],
    "additionalProperties": false,
    "properties": {
     "statement": {
      "type": "string",
      "minLength": 10,
      "maxLength": 20000,
      "description": "Why the verdict is wrong, in your words"
     },
     "links": {
      "type": "array",
      "maxItems": 20,
      "items": {
       "type": "string",
       "format": "uri",
       "maxLength": 2048
      },
      "description": "Links to logs, dashboards or documents"
     }
    }
   },
   "RecoveryCredit": {
    "type": "object",
    "required": [
     "id",
     "case_id",
     "affected_spend_micros",
     "credit_micros",
     "created_at"
    ],
    "description": "One recovered amount against the spend it covers, and the case. Returned to your prepaid balance.",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^rcr_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "case_id": {
      "$ref": "#/components/schemas/CaseId"
     },
     "affected_spend_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "credit_micros": {
      "$ref": "#/components/schemas/MicrosNonNeg"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "RecoveryCreditPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/RecoveryCredit"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "PublisherWebhookEvent": {
    "type": "object",
    "required": [
     "id",
     "type",
     "created_at",
     "data",
     "test"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/WebhookEventId"
     },
     "test": {
      "type": "boolean",
      "description": "true for a sandbox or test event (no money moved)"
     },
     "type": {
      "type": "string",
      "enum": [
       "conversion.held",
       "conversion.reversed",
       "statement.issued",
       "payout.sent",
       "placement.paused",
       "tier.changed",
       "delivery.failing",
       "case.opened",
       "case.decided",
       "case.closed"
      ]
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "data": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/PublisherConversion"
       },
       {
        "$ref": "#/components/schemas/Statement"
       },
       {
        "$ref": "#/components/schemas/Placement"
       },
       {
        "$ref": "#/components/schemas/PublisherProfile"
       },
       {
        "$ref": "#/components/schemas/DeliveryHealth"
       },
       {
        "$ref": "#/components/schemas/PublisherCase"
       }
      ]
     }
    }
   },
   "AdvertiserWebhookEvent": {
    "type": "object",
    "required": [
     "id",
     "type",
     "created_at",
     "data",
     "test"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/WebhookEventId"
     },
     "test": {
      "type": "boolean",
      "description": "true for a sandbox or test event (no money moved)"
     },
     "type": {
      "type": "string",
      "enum": [
       "offer.status_changed",
       "offer.checks_completed",
       "conversion.approved",
       "reversal.completed",
       "balance.low",
       "topup.succeeded",
       "recovery_credit.created"
      ]
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "data": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/AdvertiserOffer"
       },
       {
        "$ref": "#/components/schemas/OfferCheckRun"
       },
       {
        "$ref": "#/components/schemas/AdvertiserConversion"
       },
       {
        "$ref": "#/components/schemas/Reversal"
       },
       {
        "$ref": "#/components/schemas/AdvertiserBalance"
       },
       {
        "$ref": "#/components/schemas/TopupEvent"
       },
       {
        "$ref": "#/components/schemas/RecoveryCredit"
       }
      ]
     }
    }
   },
   "SignedLaunch": {
    "type": "object",
    "required": [
     "placement",
     "user_id",
     "ts",
     "nonce",
     "sig"
    ],
    "additionalProperties": false,
    "description": "sig = hex HMAC-SHA256(placement launch secret, \"krin-launch-v1\\n{placement}\\n{user_id}\\n{ts}\\n{nonce}\\n{sub_ids}\"), where sub_ids = keys sorted, k=v joined by &, both percent-encoded (empty when none). ts within 5 minutes; nonce single use.",
    "properties": {
     "placement": {
      "$ref": "#/components/schemas/PlacementId"
     },
     "user_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[\\x21-\\x7e]+$",
      "description": "The publisher's user id, printable ASCII without spaces"
     },
     "ts": {
      "type": "integer"
     },
     "nonce": {
      "type": "string",
      "minLength": 16,
      "maxLength": 128,
      "pattern": "^[\\x21-\\x7e]+$"
     },
     "sig": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
     },
     "sub_ids": {
      "type": "object",
      "maxProperties": 5,
      "propertyNames": {
       "pattern": "^[A-Za-z0-9_.~-]{1,32}$"
      },
      "additionalProperties": {
       "type": "string",
       "maxLength": 64
      }
     }
    }
   },
   "WallImpressionBatch": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "items"
    ],
    "properties": {
     "items": {
      "type": "array",
      "minItems": 1,
      "maxItems": 50,
      "items": {
       "$ref": "#/components/schemas/WallImpression"
      }
     }
    }
   },
   "WallImpression": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "offer_id",
     "tab",
     "position"
    ],
    "properties": {
     "offer_id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "tab": {
      "type": "string",
      "enum": [
       "for_you",
       "games",
       "apps",
       "quick",
       "surveys"
      ],
      "description": "The wall tab the tile was shown in"
     },
     "position": {
      "type": "integer",
      "minimum": 0,
      "maximum": 499,
      "description": "0-based place of the tile in that tab's list as shown; the featured card is 0"
     }
    }
   },
   "WallImpressionResult": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "accepted"
    ],
    "properties": {
     "accepted": {
      "type": "integer",
      "minimum": 0,
      "maximum": 50,
      "description": "Impressions new to this wall session"
     }
    }
   },
   "WallSession": {
    "type": "object",
    "required": [
     "token",
     "expires_at",
     "placement",
     "onboarding_done",
     "avatar"
    ],
    "properties": {
     "token": {
      "type": "string",
      "minLength": 40,
      "maxLength": 640,
      "description": "Opaque bearer token (wst_<kid>.<base64url>) for the wall calls of this session. Not a TypeID. Keep it in memory only."
     },
     "expires_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "placement": {
      "$ref": "#/components/schemas/WallPlacementView"
     },
     "onboarding_done": {
      "type": "boolean",
      "description": "The wall opens on the offers either way. False: ask the age range and the wall terms (wall.profile.update) on the first offer tap, before wall.offers.start; wall.profile.get says what is missing. True: nothing to ask."
     },
     "avatar": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "a",
       "b",
       null
      ],
      "description": "The character this user picked, or null"
     }
    }
   },
   "WallSessionView": {
    "type": "object",
    "required": [
     "expires_at",
     "placement",
     "onboarding_done",
     "avatar"
    ],
    "description": "WallSession without the token",
    "properties": {
     "expires_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "placement": {
      "$ref": "#/components/schemas/WallPlacementView"
     },
     "onboarding_done": {
      "type": "boolean",
      "description": "False: ask the age range and the wall terms before the first start; wall.profile.get says what is missing. True: nothing to ask."
     },
     "avatar": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "a",
       "b",
       null
      ],
      "description": "The character this user picked, or null"
     }
    }
   },
   "TestSessionInput": {
    "type": "object",
    "required": [
     "token"
    ],
    "additionalProperties": false,
    "properties": {
     "token": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{43}$",
      "description": "The token after /t# in the test link"
     }
    }
   },
   "TestConversionInput": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "click_id",
     "seq"
    ],
    "properties": {
     "click_id": {
      "type": "string",
      "maxLength": 64,
      "description": "The click_id from the test page's URL fragment, as t.krin.io put it there"
     },
     "seq": {
      "type": "integer",
      "minimum": 1,
      "maximum": 20,
      "description": "The step of the test offer (1 for one-step offers)"
     }
    }
   },
   "TestConversionResult": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "status"
    ],
    "properties": {
     "status": {
      "type": "string",
      "enum": [
       "received",
       "held"
      ],
      "description": "received: decided and credited shortly; held: the held test offer, credited after a few minutes"
     }
    }
   },
   "WallProfile": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "status",
     "avatar",
     "min_age",
     "terms_version",
     "terms_changed"
    ],
    "properties": {
     "status": {
      "type": "string",
      "enum": [
       "new",
       "terms",
       "ready",
       "stopped"
      ],
      "description": "new: the age range is not known yet (the list shows offers for the youngest user allowed; ask the range and the wall terms before the first start); terms: ask the current wall terms before the next start; ready: nothing to ask; stopped: show the stop screen (no retry)."
     },
     "avatar": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "a",
       "b",
       null
      ]
     },
     "min_age": {
      "type": "integer",
      "enum": [
       13,
       16,
       18
      ],
      "description": "The minimum age for this user here. The first age range is \"Under {min_age}\"; the stop screen names it."
     },
     "terms_version": {
      "type": [
       "string",
       "null"
      ],
      "description": "The current wall terms version: send it back when the user accepts."
     },
     "terms_changed": {
      "type": "boolean",
      "description": "The user accepted an older published version: say the wall terms changed."
     }
    }
   },
   "WallProfileInput": {
    "type": "object",
    "additionalProperties": false,
    "minProperties": 1,
    "properties": {
     "avatar": {
      "type": "string",
      "enum": [
       "a",
       "b"
      ]
     },
     "age_band": {
      "type": "string",
      "enum": [
       "under",
       "13_15",
       "16_17",
       "18_24",
       "25_34",
       "35_44",
       "45_54",
       "55_plus"
      ],
      "description": "The range picked. under = the first range (\"Under {min_age}\"); a range below min_age counts as under. Only the lowest age of the range is kept, at most 21. A later range may only be higher."
     },
     "terms_version": {
      "type": "string",
      "pattern": "^([0-9]{4}-[0-9]{2}-[0-9]{2}|draft)$",
      "description": "The version from wall.profile.get, when the user taps Accept and start. Needs an age range. draft only on a test wall or a Sandbox account's wall."
     }
    }
   },
   "TestWallLink": {
    "type": "object",
    "required": [
     "url",
     "expires_at"
    ],
    "properties": {
     "url": {
      "type": "string",
      "format": "uri",
      "description": "Shown once. Open it in a browser; it works one time."
     },
     "expires_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "WallMilestone": {
    "type": "object",
    "required": [
     "seq",
     "name",
     "reward"
    ],
    "properties": {
     "seq": {
      "type": "integer"
     },
     "name": {
      "type": "string"
     },
     "instruction": {
      "type": [
       "string",
       "null"
      ]
     },
     "reward": {
      "$ref": "#/components/schemas/DecimalString"
     },
     "time_limit_hours": {
      "type": [
       "integer",
       "null"
      ]
     },
     "repeatable": {
      "type": "boolean"
     }
    }
   },
   "WallOffer": {
    "type": "object",
    "required": [
     "id",
     "type",
     "title",
     "total_reward",
     "milestones"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "type": {
      "$ref": "#/components/schemas/OfferType"
     },
     "title": {
      "type": "string"
     },
     "short_description": {
      "type": [
       "string",
       "null"
      ]
     },
     "icon_url": {
      "type": [
       "string",
       "null"
      ]
     },
     "hero_url": {
      "type": [
       "string",
       "null"
      ]
     },
     "platforms": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Platform"
      }
     },
     "total_reward": {
      "$ref": "#/components/schemas/DecimalString"
     },
     "first_reward": {
      "$ref": "#/components/schemas/DecimalString"
     },
     "boost": {
      "type": [
       "string",
       "null"
      ],
      "description": "Active currency sale multiplier label"
     },
     "estimated_minutes": {
      "type": [
       "integer",
       "null"
      ]
     },
     "requirements": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "reversal_note": {
      "type": "string",
      "description": "Plain words, e.g. \"Rewards can be reversed for 21 days if the app reports fraud\""
     },
     "milestones": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WallMilestone"
      }
     },
     "survey": {
      "type": [
       "object",
       "null"
      ],
      "properties": {
       "loi_minutes": {
        "type": "integer"
       },
       "is_new": {
        "type": "boolean"
       }
      }
     }
    }
   },
   "WallOfferPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WallOffer"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "WallStartInput": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "device": {
      "type": "object",
      "description": "Client facts with provenance (rules/facts.yaml), e.g. integrity token from the Android SDK"
     }
    }
   },
   "HeadlessUser": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "user_id",
     "ip"
    ],
    "properties": {
     "user_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[\\x21-\\x7e]+$",
      "description": "Your id for the end user (printable ASCII, no spaces, not starting with krin_), the same one your wall launches use"
     },
     "ip": {
      "type": "string",
      "description": "The end user's public IP address (IPv4 or IPv6), as their device reached your server"
     },
     "user_agent": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "The user agent of the end user's browser or app web view. It decides the platform the offers are for: without it, the list has web offers only"
     },
     "q": {
      "type": "string",
      "maxLength": 80,
      "description": "Search inside the list"
     }
    }
   },
   "HeadlessStartInput": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "placement_id",
     "country",
     "user_id",
     "ip",
     "user_agent"
    ],
    "properties": {
     "placement_id": {
      "$ref": "#/components/schemas/PlacementId"
     },
     "country": {
      "$ref": "#/components/schemas/Country"
     },
     "user_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "pattern": "^[\\x21-\\x7e]+$"
     },
     "ip": {
      "type": "string",
      "description": "The end user's public IP address; the browser that opens redirect_url must come from the same /24 (IPv4) or /48 (IPv6)"
     },
     "user_agent": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "The exact user agent of the browser that will open redirect_url"
     }
    }
   },
   "WallStart": {
    "type": "object",
    "required": [
     "click_id",
     "redirect_url"
    ],
    "properties": {
     "click_id": {
      "$ref": "#/components/schemas/ClickId"
     },
     "redirect_url": {
      "type": "string",
      "format": "uri",
      "description": "https://t.krin.io/c/<single-use token>"
     }
    }
   },
   "WallReceiptMilestone": {
    "type": "object",
    "required": [
     "seq",
     "name",
     "reward",
     "status",
     "status_label",
     "reason_code",
     "reason",
     "release_at",
     "time_left_hours",
     "claimable",
     "claim",
     "timeline"
    ],
    "properties": {
     "seq": {
      "type": "integer"
     },
     "name": {
      "type": "string"
     },
     "reward": {
      "type": [
       "string",
       "null"
      ],
      "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
      "description": "In the placement currency: what was credited once approved, else what the step pays now. Null when it can't be priced now"
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "received",
       "held",
       "approved",
       "rejected",
       "reversing",
       "reversed",
       "settled",
       "expired"
      ]
     },
     "status_label": {
      "type": "string",
      "description": "The status word in English (the wall shows its own translation of status)"
     },
     "reason_code": {
      "type": [
       "string",
       "null"
      ],
      "description": "The publisher-safe reason code (the same one the publisher's postback carries), for a held, rejected, reversing or reversed step. Clients translate it; never a rule or threshold"
     },
     "reason": {
      "type": [
       "string",
       "null"
      ],
      "description": "Plain-language category in English (reason_codes.*.user), never thresholds. Null when there is no text for the code"
     },
     "release_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "On a held step: when it will be decided"
     },
     "time_left_hours": {
      "type": [
       "integer",
       "null"
      ],
      "description": "On a pending step with a time limit: whole hours left"
     },
     "claimable": {
      "type": "boolean",
      "description": "A missing-reward claim can be filed for this step now"
     },
     "claim": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "type": "object",
        "required": [
         "id",
         "status",
         "advertiser_due_at"
        ],
        "properties": {
         "id": {
          "$ref": "#/components/schemas/ClaimId"
         },
         "status": {
          "$ref": "#/components/schemas/ClaimStatus"
         },
         "advertiser_due_at": {
          "type": [
           "string",
           "null"
          ],
          "format": "date-time"
         }
        }
       }
      ]
     },
     "timeline": {
      "type": "array",
      "description": "When the step reached each status KRIN records a time for, oldest first",
      "items": {
       "type": "object",
       "required": [
        "status",
        "at"
       ],
       "properties": {
        "status": {
         "type": "string",
         "enum": [
          "received",
          "approved",
          "reversing",
          "settled"
         ]
        },
        "at": {
         "$ref": "#/components/schemas/Timestamp"
        }
       }
      }
     }
    }
   },
   "WallReceipt": {
    "type": "object",
    "required": [
     "click_id",
     "offer_id",
     "title",
     "icon_url",
     "started_at",
     "opened_at",
     "claimable",
     "milestones"
    ],
    "properties": {
     "click_id": {
      "$ref": "#/components/schemas/ClickId"
     },
     "offer_id": {
      "$ref": "#/components/schemas/OfferId"
     },
     "title": {
      "type": "string"
     },
     "icon_url": {
      "type": [
       "string",
       "null"
      ]
     },
     "started_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "opened_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "When the offer was opened through the tracking link"
     },
     "milestones": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WallReceiptMilestone"
      }
     },
     "claimable": {
      "type": "boolean",
      "description": "At least one step can be claimed now"
     }
    }
   },
   "SdkNonce": {
    "type": "object",
    "required": [
     "server_nonce",
     "expires_at"
    ],
    "properties": {
     "server_nonce": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{43}$",
      "description": "base64url of 32 random bytes"
     },
     "expires_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "SdkAttestationInput": {
    "type": "object",
    "required": [
     "server_nonce",
     "chain"
    ],
    "additionalProperties": false,
    "properties": {
     "server_nonce": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_-]{43}$",
      "description": "A key_attestation nonce of this session from wall.sdk_nonces.create"
     },
     "chain": {
      "type": "array",
      "minItems": 2,
      "maxItems": 8,
      "items": {
       "type": "string",
       "contentEncoding": "base64"
      },
      "description": "The key's attestation certificate chain, leaf first: base64 (standard alphabet) of each certificate's DER"
     }
    }
   },
   "SdkSession": {
    "type": "object",
    "required": [
     "sdk_session_id",
     "expires_at"
    ],
    "properties": {
     "sdk_session_id": {
      "type": "string",
      "pattern": "^sdk_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     },
     "expires_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "WallReceiptPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WallReceipt"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     },
     "placement": {
      "$ref": "#/components/schemas/WallPlacementView",
      "description": "Only on a status-link read (Krin-Status-Link header), on every page: the page has no wall session to take it from. Absent on a session read."
     }
    }
   },
   "WallPlacementView": {
    "type": "object",
    "required": [
     "name",
     "kind",
     "currency",
     "theme",
     "sandbox"
    ],
    "description": "What the wall shows of its placement: the name, the reward currency and the look",
    "properties": {
     "name": {
      "type": "string"
     },
     "kind": {
      "type": "string"
     },
     "currency": {
      "type": "object",
      "properties": {
       "name": {
        "type": "string"
       },
       "name_plural": {
        "type": "string"
       },
       "icon_url": {
        "type": [
         "string",
         "null"
        ]
       },
       "decimals": {
        "type": "integer"
       }
      }
     },
     "theme": {
      "$ref": "#/components/schemas/WallTheme"
     },
     "sandbox": {
      "type": "boolean",
      "description": "True for a test wall and for a Sandbox account's wall: show the \"Test wall\" mark. Nothing earned there is paid."
     }
    }
   },
   "ClaimInput": {
    "type": "object",
    "required": [
     "seq"
    ],
    "additionalProperties": false,
    "properties": {
     "seq": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000,
      "description": "Milestone the user says they completed"
     },
     "note": {
      "type": "string",
      "maxLength": 1000,
      "description": "For the advertiser. Control, bidi and zero-width characters are removed; line breaks become spaces"
     },
     "screenshot_upload_id": {
      "type": "string",
      "description": "Not taken yet: there is no upload route, and a request that sends it is refused"
     }
    }
   },
   "WallClaim": {
    "type": "object",
    "required": [
     "id",
     "status",
     "decision_reason",
     "advertiser_due_at",
     "created"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/ClaimId"
     },
     "status": {
      "$ref": "#/components/schemas/ClaimStatus"
     },
     "decision_reason": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "duplicate_user",
       null
      ],
      "description": "Set only when tracking data answered at once that this person already completed the offer"
     },
     "advertiser_due_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "The advertiser answers by then"
     },
     "created": {
      "type": "boolean",
      "description": "false when this step already had a claim: the answer is that claim"
     }
    }
   },
   "SurveyProfile": {
    "type": "object",
    "required": [
     "sections"
    ],
    "properties": {
     "sections": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "id",
        "title",
        "questions"
       ],
       "properties": {
        "id": {
         "type": "string"
        },
        "title": {
         "type": "string"
        },
        "skippable": {
         "type": "boolean"
        },
        "questions": {
         "type": "array",
         "items": {
          "type": "object",
          "required": [
           "id",
           "text",
           "kind"
          ],
          "properties": {
           "id": {
            "type": "string"
           },
           "text": {
            "type": "string"
           },
           "kind": {
            "type": "string",
            "enum": [
             "single",
             "multi",
             "number",
             "date"
            ]
           },
           "options": {
            "type": "array",
            "items": {
             "type": "object",
             "properties": {
              "id": {
               "type": "string"
              },
              "label": {
               "type": "string"
              }
             }
            }
           },
           "answer": {}
          }
         }
        }
       }
      }
     },
     "completion": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
     }
    }
   },
   "SurveyProfileAnswers": {
    "type": "object",
    "required": [
     "answers"
    ],
    "additionalProperties": false,
    "properties": {
     "answers": {
      "type": "object",
      "additionalProperties": true
     }
    }
   },
   "RuleLayer": {
    "type": "string",
    "enum": [
     "wall",
     "click",
     "conversion",
     "inbound_postback",
     "offer",
     "publisher",
     "payout",
     "api",
     "agent",
     "ai",
     "metric"
    ]
   },
   "RuleInput": {
    "type": "object",
    "required": [
     "code",
     "name",
     "scope_type",
     "layer",
     "definition"
    ],
    "additionalProperties": false,
    "properties": {
     "code": {
      "type": "string",
      "pattern": "^[A-Z]{2,4}-[0-9A-Z]{1,12}$"
     },
     "name": {
      "type": "string",
      "maxLength": 120
     },
     "scope_type": {
      "type": "string",
      "enum": [
       "advertiser",
       "offer",
       "publisher",
       "placement"
      ]
     },
     "scope_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "layer": {
      "$ref": "#/components/schemas/RuleLayer"
     },
     "mode": {
      "type": "string",
      "enum": [
       "shadow",
       "live"
      ],
      "default": "shadow"
     },
     "definition": {
      "type": "object",
      "description": "rules/rule.schema.json#/$defs/definition (conditions tree + action). Validated at save time against rules/facts.yaml."
     }
    }
   },
   "Rule": {
    "type": "object",
    "required": [
     "id",
     "code",
     "name",
     "owner_side",
     "scope_type",
     "layer",
     "mode",
     "version",
     "status"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/RuleId"
     },
     "code": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "owner_side": {
      "type": "string",
      "enum": [
       "krin",
       "advertiser",
       "publisher"
      ]
     },
     "scope_type": {
      "type": "string"
     },
     "scope_id": {
      "type": [
       "string",
       "null"
      ]
     },
     "layer": {
      "$ref": "#/components/schemas/RuleLayer"
     },
     "mode": {
      "type": "string",
      "enum": [
       "shadow",
       "live"
      ]
     },
     "disclosure": {
      "type": "string",
      "enum": [
       "public",
       "standard",
       "sensitive"
      ]
     },
     "version": {
      "type": "integer"
     },
     "definition": {
      "type": [
       "object",
       "null"
      ],
      "description": "Null for KRIN baseline rules (definitions are never tenant-readable)"
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "disabled"
      ]
     },
     "hits_7d": {
      "type": "integer"
     }
    }
   },
   "RulePage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Rule"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "DecisionId": {
    "type": "string",
    "pattern": "^hit_[0-7][0-9a-hjkmnp-tv-z]{25}$",
    "description": "One rule decision (one rule hit)"
   },
   "Decision": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "occurred_at",
     "subject_type",
     "subject_id",
     "layer",
     "mode",
     "action",
     "reason_code",
     "rule_code",
     "rule_name",
     "owner_side",
     "own",
     "rule_id",
     "rule_version",
     "facts"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/DecisionId"
     },
     "occurred_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "subject_type": {
      "type": "string",
      "enum": [
       "click",
       "conversion",
       "offer"
      ]
     },
     "subject_id": {
      "type": "string",
      "description": "clk_, cnv_ or ofr_ id"
     },
     "layer": {
      "$ref": "#/components/schemas/RuleLayer"
     },
     "mode": {
      "type": "string",
      "enum": [
       "shadow",
       "live"
      ],
      "description": "shadow: the rule only recorded what it would have done (your own rules only)"
     },
     "action": {
      "type": "string",
      "enum": [
       "allow",
       "cap",
       "challenge",
       "hold",
       "reject",
       "block",
       "reverse",
       "pause",
       "notify",
       "open_case",
       "withhold"
      ]
     },
     "reason_code": {
      "type": [
       "string",
       "null"
      ],
      "description": "Your own rules keep their code; another organization's rule and KRIN's show the code you may read (a concealed one as under_review, not_credited or advertiser_quality_review)"
     },
     "rule_code": {
      "type": "string",
      "description": "Your own rule's code; krin_integrity for a KRIN rule; advertiser_rule or publisher_rule for another organization's"
     },
     "rule_name": {
      "type": [
       "string",
       "null"
      ],
      "description": "Your own rule's name; for a KRIN rule its name when the reason code is actionable, \"KRIN Conversion Integrity\" otherwise; null for another organization's rule"
     },
     "owner_side": {
      "type": "string",
      "enum": [
       "krin",
       "advertiser",
       "publisher"
      ]
     },
     "own": {
      "type": "boolean",
      "description": "The rule is your organization's"
     },
     "rule_id": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/RuleId"
       },
       {
        "type": "null"
       }
      ],
      "description": "Your own rules only"
     },
     "rule_version": {
      "type": [
       "integer",
       "null"
      ],
      "description": "Your own rules only"
     },
     "facts": {
      "type": "array",
      "description": "Your own rules only (empty otherwise): the facts the rule read that your side may see. A value only for click.to_install_seconds, event.below_offer_minimum, event.duplicate, event.gap_from_previous_seconds, event.inside_time_limit, event.out_of_order, event.prerequisite_expired, geo.matches_offer, install.device_match, install.network_match, pb.app_matches, pb.click_known and pb.event_declared; any other fact by name only.",
      "items": {
       "type": "object",
       "additionalProperties": false,
       "required": [
        "name"
       ],
       "properties": {
        "name": {
         "type": "string"
        },
        "value": {}
       }
      }
     }
    }
   },
   "DecisionPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Decision"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "DecisionExplanation": {
    "type": "object",
    "required": [
     "subject_id",
     "outcome",
     "steps"
    ],
    "properties": {
     "subject_id": {
      "type": "string",
      "description": "The clk_ or cnv_ id asked about"
     },
     "outcome": {
      "type": "string",
      "description": "A conversion's status (ConversionStatus) or a click's decision (allowed, challenged, blocked)"
     },
     "steps": {
      "type": "array",
      "maxItems": 100,
      "items": {
       "type": "object",
       "required": [
        "text",
        "decision"
       ],
       "properties": {
        "text": {
         "type": "string",
         "description": "The decision in plain words"
        },
        "decision": {
         "$ref": "#/components/schemas/Decision"
        }
       }
      }
     }
    }
   },
   "Fact": {
    "type": "object",
    "required": [
     "name",
     "type",
     "provenance",
     "layers"
    ],
    "properties": {
     "name": {
      "type": "string",
      "description": "e.g. device.key_attestation_level"
     },
     "type": {
      "type": "string",
      "enum": [
       "bool",
       "int",
       "number",
       "string",
       "enum",
       "string_set",
       "duration_seconds",
       "money_micros",
       "country"
      ]
     },
     "values": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "provenance": {
      "type": "string",
      "enum": [
       "krin_measured",
       "attested",
       "advertiser_claimed",
       "publisher_claimed",
       "client_claimed"
      ]
     },
     "layers": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/RuleLayer"
      }
     },
     "description": {
      "type": "string"
     }
    }
   },
   "MetricCatalog": {
    "type": "object",
    "required": [
     "metrics",
     "dimensions"
    ],
    "properties": {
     "metrics": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "id",
        "label",
        "unit"
       ],
       "properties": {
        "id": {
         "type": "string",
         "pattern": "^(pub|adv|ctl)\\.[a-z0-9_]+$"
        },
        "label": {
         "type": "string"
        },
        "unit": {
         "type": "string",
         "enum": [
          "count",
          "micros",
          "ratio",
          "seconds",
          "minutes",
          "days",
          "currency"
         ]
        },
        "definition": {
         "type": "string"
        },
        "dimensions": {
         "type": "array",
         "items": {
          "type": "string"
         },
         "description": "Dimensions this metric can be grouped or filtered by for the caller"
        },
        "requires_single": {
         "type": "string",
         "description": "The query must group or filter to exactly one value of this dimension (currency metrics: placement)"
        }
       }
      }
     },
     "dimensions": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "id",
        "label"
       ],
       "properties": {
        "id": {
         "type": "string"
        },
        "label": {
         "type": "string"
        }
       }
      }
     }
    }
   },
   "MetricQuery": {
    "type": "object",
    "required": [
     "metrics",
     "from",
     "to"
    ],
    "additionalProperties": false,
    "properties": {
     "metrics": {
      "type": "array",
      "minItems": 1,
      "maxItems": 10,
      "items": {
       "type": "string"
      }
     },
     "dimensions": {
      "type": "array",
      "maxItems": 3,
      "items": {
       "type": "string"
      }
     },
     "filters": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "dimension",
        "op",
        "values"
       ],
       "properties": {
        "dimension": {
         "type": "string"
        },
        "op": {
         "type": "string",
         "enum": [
          "in",
          "not_in"
         ]
        },
        "values": {
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       }
      }
     },
     "from": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "to": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "granularity": {
      "type": "string",
      "enum": [
       "hour",
       "day",
       "week",
       "month",
       "total"
      ],
      "default": "day"
     },
     "timezone": {
      "type": "string",
      "default": "UTC"
     }
    }
   },
   "MetricResult": {
    "type": "object",
    "required": [
     "columns",
     "rows",
     "as_of"
    ],
    "properties": {
     "columns": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string"
        },
        "kind": {
         "type": "string",
         "enum": [
          "time",
          "dimension",
          "metric"
         ]
        },
        "unit": {
         "type": "string"
        }
       }
      }
     },
     "rows": {
      "type": "array",
      "items": {
       "type": "array",
       "items": {}
      }
     },
     "as_of": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "freshness_seconds": {
      "type": "integer"
     }
    }
   },
   "SavedViewInput": {
    "type": "object",
    "required": [
     "name",
     "query"
    ],
    "additionalProperties": false,
    "properties": {
     "name": {
      "type": "string",
      "maxLength": 80
     },
     "query": {
      "$ref": "#/components/schemas/MetricQuery"
     },
     "chart": {
      "type": "string",
      "enum": [
       "line",
       "bar",
       "table",
       "number"
      ]
     }
    }
   },
   "SavedView": {
    "allOf": [
     {
      "$ref": "#/components/schemas/SavedViewInput"
     },
     {
      "type": "object",
      "required": [
       "id"
      ],
      "properties": {
       "id": {
        "type": "string"
       },
       "created_by": {
        "$ref": "#/components/schemas/ActorRef"
       }
      }
     }
    ]
   },
   "ExportInput": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
     "query": {
      "$ref": "#/components/schemas/MetricQuery"
     },
     "list_operation": {
      "type": "string",
      "description": "A list operationId, e.g. publisher.conversions.list"
     },
     "list_params": {
      "type": "object"
     },
     "format": {
      "type": "string",
      "enum": [
       "csv"
      ],
      "default": "csv"
     }
    }
   },
   "Export": {
    "type": "object",
    "required": [
     "id",
     "status"
    ],
    "properties": {
     "id": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "queued",
       "running",
       "ready",
       "failed"
      ]
     },
     "download_url": {
      "type": [
       "string",
       "null"
      ],
      "format": "uri"
     },
     "expires_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "rows": {
      "type": [
       "integer",
       "null"
      ]
     }
    }
   },
   "SearchResult": {
    "type": "object",
    "required": [
     "items"
    ],
    "properties": {
     "items": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "kind",
        "title",
        "link"
       ],
       "properties": {
        "kind": {
         "type": "string",
         "enum": [
          "page",
          "setting",
          "entity",
          "action",
          "doc"
         ]
        },
        "title": {
         "type": "string"
        },
        "subtitle": {
         "type": "string"
        },
        "link": {
         "type": "string"
        },
        "operation_id": {
         "type": [
          "string",
          "null"
         ]
        }
       }
      }
     }
    }
   },
   "WebhookEventType": {
    "type": "string",
    "description": "Publisher side: conversion.held, conversion.reversed, statement.issued, payout.sent, placement.paused, tier.changed, delivery.failing, case.opened, case.decided, case.closed. Advertiser side: offer.status_changed, offer.checks_completed, conversion.approved, reversal.completed, balance.low, topup.succeeded, recovery_credit.created.",
    "enum": [
     "conversion.held",
     "conversion.reversed",
     "statement.issued",
     "payout.sent",
     "placement.paused",
     "tier.changed",
     "delivery.failing",
     "case.opened",
     "case.decided",
     "case.closed",
     "offer.status_changed",
     "offer.checks_completed",
     "conversion.approved",
     "reversal.completed",
     "balance.low",
     "topup.succeeded",
     "recovery_credit.created"
    ]
   },
   "WebhookEndpointInput": {
    "type": "object",
    "required": [
     "url",
     "event_types"
    ],
    "additionalProperties": false,
    "properties": {
     "url": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "maxLength": 2048,
      "description": "https on port 443, a public host name (not an IP address, not a KRIN host), no user or password, no #fragment"
     },
     "event_types": {
      "type": "array",
      "minItems": 1,
      "maxItems": 20,
      "uniqueItems": true,
      "items": {
       "$ref": "#/components/schemas/WebhookEventType"
      },
      "description": "Event types of the endpoint's side"
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "disabled"
      ],
      "default": "active"
     },
     "side": {
      "$ref": "#/components/schemas/Side",
      "description": "Required when the organization has both sides; fixed once created"
     }
    }
   },
   "WebhookEndpointPatch": {
    "type": "object",
    "minProperties": 1,
    "additionalProperties": false,
    "properties": {
     "url": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://",
      "maxLength": 2048
     },
     "event_types": {
      "type": "array",
      "minItems": 1,
      "maxItems": 20,
      "uniqueItems": true,
      "items": {
       "$ref": "#/components/schemas/WebhookEventType"
      }
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "disabled"
      ]
     }
    }
   },
   "WebhookEndpoint": {
    "type": "object",
    "required": [
     "id",
     "side",
     "url",
     "event_types",
     "status"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/WebhookId"
     },
     "side": {
      "$ref": "#/components/schemas/Side"
     },
     "url": {
      "type": "string",
      "description": "In full for a developer, admin or owner. An API key sees the origin, \"/…\" and the last 4 characters of the path and query, because a receiver URL often carries a secret"
     },
     "event_types": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WebhookEventType"
      }
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "disabled"
      ]
     },
     "disabled_reason": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "member",
       "failing",
       null
      ],
      "description": "member = turned off by a person; failing = turned off after deliveries failed in a row"
     },
     "secret_hint": {
      "type": [
       "string",
       "null"
      ],
      "description": "The last 4 characters of the signing secret"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "updated_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "WebhookEndpointCreated": {
    "allOf": [
     {
      "$ref": "#/components/schemas/WebhookEndpoint"
     },
     {
      "type": "object",
      "required": [
       "signing_secret"
      ],
      "properties": {
       "signing_secret": {
        "type": "string",
        "minLength": 68,
        "maxLength": 68,
        "description": "kws_ and 64 hex characters. Shown once. Each delivery carries Krin-Signature t=<unix seconds>,v1=<hex HMAC-SHA256(secret, t + \".\" + body)>; accept a t within 5 minutes and dedupe on the event id."
       }
      }
     }
    ]
   },
   "WebhookEventId": {
    "type": "string",
    "pattern": "^whe_[0-7][0-9a-hjkmnp-tv-z]{25}$",
    "description": "One webhook event (the same for every endpoint it went to); dedupe on it"
   },
   "WebhookDeliveryId": {
    "type": "string",
    "pattern": "^whd_[0-7][0-9a-hjkmnp-tv-z]{25}$",
    "description": "One event to one endpoint"
   },
   "WebhookDelivery": {
    "type": "object",
    "required": [
     "id",
     "event_id",
     "event_type",
     "status",
     "attempts"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/WebhookDeliveryId"
     },
     "event_id": {
      "$ref": "#/components/schemas/WebhookEventId"
     },
     "event_type": {
      "$ref": "#/components/schemas/WebhookEventType"
     },
     "status": {
      "$ref": "#/components/schemas/DeliveryStatus"
     },
     "attempt_count": {
      "type": "integer",
      "minimum": 0
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "delivered_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "next_attempt_at": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time",
      "description": "Set while queued or retrying"
     },
     "last_http_status": {
      "type": [
       "integer",
       "null"
      ]
     },
     "last_error": {
      "type": [
       "string",
       "null"
      ],
      "description": "The last KRIN-side reason, e.g. endpoint_deleted"
     },
     "attempts": {
      "type": "array",
      "maxItems": 50,
      "items": {
       "$ref": "#/components/schemas/DeliveryAttempt"
      },
      "description": "Newest first. request_url follows the rule of WebhookEndpoint.url"
     }
    }
   },
   "WebhookReplayInput": {
    "type": "object",
    "additionalProperties": false,
    "description": "Either ids, or both from and to (the delivery's creation time). status narrows the range to delivered or failed (failed when left out); with ids both are replayed unless status names one.",
    "properties": {
     "ids": {
      "type": "array",
      "minItems": 1,
      "maxItems": 1000,
      "items": {
       "$ref": "#/components/schemas/WebhookDeliveryId"
      }
     },
     "from": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "to": {
      "$ref": "#/components/schemas/Timestamp"
     },
     "status": {
      "type": "string",
      "enum": [
       "delivered",
       "failed"
      ]
     }
    }
   },
   "WebhookDeliveryPage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WebhookDelivery"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "AdvertiserSandboxKit": {
    "type": "object",
    "required": [
     "keys",
     "test_offer"
    ],
    "properties": {
     "keys": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ApiKeyCreated"
      }
     },
     "test_offer": {
      "$ref": "#/components/schemas/AdvertiserOffer"
     }
    }
   },
   "PublisherSandboxKit": {
    "type": "object",
    "required": [
     "keys",
     "test_placement"
    ],
    "properties": {
     "keys": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ApiKeyCreated"
      }
     },
     "test_placement": {
      "$ref": "#/components/schemas/Placement"
     }
    }
   },
   "SandboxEventInput": {
    "type": "object",
    "required": [
     "kind",
     "placement_id"
    ],
    "additionalProperties": false,
    "description": "KRIN picks its own test offer for the kind and makes the test user: the body names neither",
    "properties": {
     "kind": {
      "type": "string",
      "enum": [
       "click",
       "conversion",
       "reversal",
       "hold"
      ],
      "description": "click: a test click only. conversion: credited once KRIN decides it. hold: held for a few minutes, then credited. reversal: credited, then reversed a few minutes later"
     },
     "placement_id": {
      "$ref": "#/components/schemas/PlacementId"
     }
    }
   },
   "SandboxEventResult": {
    "type": "object",
    "required": [
     "kind",
     "click_id",
     "conversion_id",
     "status",
     "user_id",
     "steps"
    ],
    "properties": {
     "kind": {
      "type": "string"
     },
     "click_id": {
      "$ref": "#/components/schemas/ClickId"
     },
     "conversion_id": {
      "type": [
       "string",
       "null"
      ],
      "description": "null for kind click"
     },
     "status": {
      "type": [
       "string",
       "null"
      ],
      "enum": [
       "received",
       "held",
       null
      ],
      "description": "The test conversion as it was recorded; KRIN decides it next"
     },
     "user_id": {
      "type": "string",
      "description": "The test user KRIN made for this event (krin_fire_..): your server sees it in the postback"
     },
     "steps": {
      "type": "array",
      "description": "What was recorded and what happens next; ok false = waiting on something named in detail",
      "items": {
       "type": "object",
       "required": [
        "step",
        "ok",
        "detail_code",
        "params",
        "detail"
       ],
       "properties": {
        "step": {
         "type": "string",
         "enum": [
          "click",
          "conversion",
          "decision",
          "postback",
          "reversal"
         ]
        },
        "ok": {
         "type": "boolean"
        },
        "detail_code": {
         "type": "string",
         "enum": [
          "click_recorded",
          "conversion_received",
          "conversion_held",
          "decision_on",
          "decision_waiting",
          "postback_no_url",
          "postback_waiting",
          "postback_on",
          "reversal_after"
         ],
         "description": "Show the text for this code; detail is the English fallback"
        },
        "params": {
         "type": "object",
         "properties": {
          "minutes": {
           "type": "integer"
          }
         },
         "description": "Values the text names: minutes for conversion_held and reversal_after"
        },
        "detail": {
         "type": "string",
         "description": "English fallback for an unknown detail_code"
        }
       }
      }
     },
     "delivery": {
      "oneOf": [
       {
        "type": "null"
       },
       {
        "$ref": "#/components/schemas/DeliveryAttempt"
       }
      ],
      "description": "Always null: the postback is sent after KRIN credits the conversion (publisher.deliveries.list)"
     }
    }
   },
   "AiMessageInput": {
    "type": "object",
    "required": [
     "message"
    ],
    "additionalProperties": false,
    "properties": {
     "message": {
      "type": "string",
      "minLength": 1,
      "maxLength": 20000
     },
     "page_context": {
      "type": "object",
      "description": "Current console page and selected entity ids",
      "additionalProperties": true
     },
     "attachments": {
      "type": "array",
      "maxItems": 5,
      "items": {
       "type": "object",
       "properties": {
        "upload_id": {
         "type": "string"
        }
       }
      }
     }
    }
   },
   "AiEvent": {
    "type": "object",
    "required": [
     "type"
    ],
    "description": "One server-sent event",
    "properties": {
     "type": {
      "type": "string",
      "enum": [
       "conversation",
       "text_delta",
       "tool_call",
       "tool_result",
       "confirmation_required",
       "done",
       "error"
      ]
     },
     "conversation_id": {
      "type": "string"
     },
     "text": {
      "type": "string"
     },
     "tool": {
      "type": "object",
      "properties": {
       "operation_id": {
        "type": "string"
       },
       "input": {
        "type": "object"
       },
       "dry_run": {
        "type": "boolean"
       }
      }
     },
     "confirmation": {
      "$ref": "#/components/schemas/Confirmation"
     },
     "usage": {
      "type": "object",
      "properties": {
       "input_tokens": {
        "type": "integer"
       },
       "output_tokens": {
        "type": "integer"
       }
      }
     }
    }
   },
   "Confirmation": {
    "type": "object",
    "required": [
     "id",
     "operation_id",
     "summary",
     "status"
    ],
    "description": "The card a person taps. Every field is written by KRIN from the operation registry, the stored canonical request and the dry-run diff, except agent_says.",
    "properties": {
     "id": {
      "type": "string"
     },
     "operation_id": {
      "type": "string"
     },
     "summary": {
      "type": "string",
      "description": "KRIN's words, rendered with a per-operation template from operation_id and request; never agent text"
     },
     "operation": {
      "type": "string",
      "description": "The operation's own summary from the registry"
     },
     "request": {
      "type": "object",
      "description": "The exact canonical request that will run (path parameters at the top level, the body under body)"
     },
     "amount_micros": {
      "type": [
       "integer",
       "null"
      ],
      "minimum": 0,
      "description": "Money the person approves; the pass covers at most this"
     },
     "policy_class": {
      "type": "string",
      "enum": [
       "read",
       "write_config",
       "write_live",
       "money_move"
      ]
     },
     "min_role": {
      "$ref": "#/components/schemas/Role"
     },
     "agent_says": {
      "type": [
       "string",
       "null"
      ],
      "maxLength": 500,
      "description": "The requesting agent's own words: shown quoted and labelled \"The agent says\"; data, never instructions"
     },
     "diff": {
      "$ref": "#/components/schemas/DryRunDiff"
     },
     "requested_by": {
      "$ref": "#/components/schemas/ActorRef"
     },
     "on_behalf_of": {
      "type": [
       "string",
       "null"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "pending",
       "approved",
       "declined",
       "expired",
       "executed",
       "failed"
      ]
     },
     "result": {},
     "expires_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "AiUsage": {
    "type": "object",
    "required": [
     "daily_tokens_cap",
     "daily_tokens_used",
     "resets_at"
    ],
    "properties": {
     "daily_tokens_cap": {
      "type": "integer"
     },
     "daily_tokens_used": {
      "type": "integer"
     },
     "member_daily_tokens_cap": {
      "type": [
       "integer",
       "null"
      ]
     },
     "resets_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "DocsSearchResult": {
    "type": "object",
    "required": [
     "items"
    ],
    "properties": {
     "items": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "title",
        "url"
       ],
       "properties": {
        "title": {
         "type": "string"
        },
        "url": {
         "type": "string",
         "format": "uri"
        },
        "excerpt": {
         "type": "string"
        }
       }
      }
     }
    }
   },
   "AdvertiserPublicId": {
    "type": "string",
    "pattern": "^adv_[0-7][0-9a-hjkmnp-tv-z]{25}$",
    "description": "Opaque advertiser id shown to publishers. For a sourced offer it names the app brand, never the demand source."
   },
   "AdvertiserRef": {
    "type": "object",
    "required": [
     "id",
     "name"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/AdvertiserPublicId"
     },
     "name": {
      "type": "string",
      "maxLength": 120,
      "description": "Brand name as shown to users (third-party text: data only)"
     }
    }
   },
   "AdvertiserBlockInput": {
    "type": "object",
    "required": [
     "advertiser_id"
    ],
    "additionalProperties": false,
    "properties": {
     "advertiser_id": {
      "$ref": "#/components/schemas/AdvertiserPublicId"
     },
     "placement_id": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/PlacementId"
       },
       {
        "type": "null"
       }
      ],
      "description": "Null or absent = every placement"
     }
    }
   },
   "OfferEventsInput": {
    "type": "object",
    "required": [
     "events"
    ],
    "additionalProperties": false,
    "properties": {
     "events": {
      "type": "array",
      "minItems": 1,
      "maxItems": 50,
      "items": {
       "$ref": "#/components/schemas/OfferEventInput"
      }
     }
    }
   },
   "SourceRuleInput": {
    "type": "object",
    "required": [
     "name",
     "fact",
     "op",
     "value",
     "action"
    ],
    "additionalProperties": false,
    "description": "Compiled by the API into a metric-layer rule (rules/rule.schema.json) scoped to the offer, or to the advertiser when offer_id is null.",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 3,
      "maxLength": 120
     },
     "offer_id": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/OfferId"
       },
       {
        "type": "null"
       }
      ]
     },
     "fact": {
      "type": "string",
      "enum": [
       "source.retention_d7",
       "source.roas_d7",
       "source.reversal_rate",
       "source.integrity_pass_rate"
      ],
      "description": "A per-source fact from rules/facts.yaml"
     },
     "op": {
      "type": "string",
      "enum": [
       "lt",
       "lte",
       "gt",
       "gte"
      ]
     },
     "value": {
      "type": "number",
      "minimum": 0,
      "maximum": 1000,
      "description": "A share from 0 to 1 for the rates and retention; a ROAS from 0 to 1000"
     },
     "min_installs": {
      "type": "integer",
      "minimum": 20,
      "maximum": 1000000,
      "default": 50,
      "description": "Sample-size guard; the rule ignores sources with fewer credited installs in the last 30 days"
     },
     "action": {
      "type": "string",
      "enum": [
       "pause",
       "block",
       "notify"
      ]
     },
     "mode": {
      "type": "string",
      "enum": [
       "shadow",
       "live"
      ],
      "default": "shadow"
     }
    }
   },
   "SourceRule": {
    "type": "object",
    "additionalProperties": false,
    "required": [
     "id",
     "code",
     "name",
     "offer_id",
     "fact",
     "op",
     "value",
     "min_installs",
     "action",
     "reason_code",
     "mode",
     "version",
     "status",
     "created_at"
    ],
    "properties": {
     "id": {
      "$ref": "#/components/schemas/RuleId"
     },
     "code": {
      "type": "string",
      "description": "SRC- and ten characters, made by KRIN"
     },
     "name": {
      "type": "string"
     },
     "offer_id": {
      "oneOf": [
       {
        "$ref": "#/components/schemas/OfferId"
       },
       {
        "type": "null"
       }
      ],
      "description": "Null = every offer of yours"
     },
     "fact": {
      "type": "string",
      "enum": [
       "source.retention_d7",
       "source.roas_d7",
       "source.reversal_rate",
       "source.integrity_pass_rate"
      ]
     },
     "op": {
      "type": "string",
      "enum": [
       "lt",
       "lte",
       "gt",
       "gte"
      ]
     },
     "value": {
      "type": "number"
     },
     "min_installs": {
      "type": "integer"
     },
     "action": {
      "type": "string",
      "enum": [
       "pause",
       "block",
       "notify"
      ]
     },
     "reason_code": {
      "type": "string",
      "description": "The reason code its decisions carry, for example source_reversal_rate_high"
     },
     "mode": {
      "type": "string",
      "enum": [
       "shadow",
       "live"
      ]
     },
     "version": {
      "type": "integer"
     },
     "status": {
      "type": "string",
      "enum": [
       "active",
       "disabled"
      ],
      "description": "disabled = archived"
     },
     "created_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "SourceRulePage": {
    "type": "object",
    "required": [
     "data",
     "page"
    ],
    "properties": {
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/SourceRule"
      }
     },
     "page": {
      "$ref": "#/components/schemas/PageInfo"
     }
    }
   },
   "AccountHealth": {
    "type": "object",
    "required": [
     "side",
     "status",
     "checks",
     "generated_at"
    ],
    "description": "Facts about the caller's own account only. No scores, no comparison with other accounts.",
    "properties": {
     "side": {
      "$ref": "#/components/schemas/Side"
     },
     "status": {
      "type": "string",
      "enum": [
       "ok",
       "attention",
       "blocked"
      ]
     },
     "checks": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "key",
        "status"
       ],
       "properties": {
        "key": {
         "type": "string",
         "enum": [
          "kyb",
          "integration",
          "test_postback",
          "deliveries",
          "offer_checks",
          "balance_runway",
          "level_progress",
          "open_cases",
          "webhooks",
          "payout_method"
         ]
        },
        "status": {
         "type": "string",
         "enum": [
          "ok",
          "attention",
          "blocked",
          "not_applicable"
         ]
        },
        "metric_id": {
         "type": [
          "string",
          "null"
         ],
         "description": "id behind the value"
        },
        "value": {
         "type": [
          "number",
          "string",
          "null"
         ]
        },
        "detail": {
         "type": "string"
        },
        "fix_operation_id": {
         "type": [
          "string",
          "null"
         ],
         "description": "The operation (or MCP tool) that fixes it"
        }
       }
      }
     },
     "generated_at": {
      "$ref": "#/components/schemas/Timestamp"
     }
    }
   },
   "PostbackAnswer": {
    "type": "object",
    "required": [
     "status"
    ],
    "properties": {
     "status": {
      "type": "string",
      "enum": [
       "accepted",
       "duplicate",
       "ignored"
      ]
     },
     "conversion_id": {
      "type": "string",
      "pattern": "^cnv_[0-7][0-9a-hjkmnp-tv-z]{25}$"
     }
    }
   },
   "PostbackError": {
    "type": "object",
    "required": [
     "error"
    ],
    "properties": {
     "error": {
      "type": "string",
      "enum": [
       "pb_bad_parameter",
       "pb_duplicate_parameter",
       "pb_unauthenticated",
       "pb_unknown_click",
       "pb_undeclared_event",
       "pb_app_mismatch",
       "pb_bad_timestamp",
       "not_found",
       "rate_limited",
       "not_configured",
       "unavailable"
      ]
     }
    }
   }
  }
 }
}
