{
 "openapi": "3.1.0",
 "info": {
  "title": "RottenAds API",
  "version": "1.0.0",
  "description": "Search the offers of RottenAds (affiliate network operated by Rotten Marketing LLC) and apply as a publisher or an advertiser. No authentication. Applications are reviewed by a person before any account is created; the answer goes to the applicant's email. The same is available as an MCP server at https://rottenads.com/mcp.",
  "contact": {"name": "RottenAds", "email": "info@rottenads.com", "url": "https://rottenads.com"}
 },
 "servers": [{"url": "https://rottenads.com"}],
 "paths": {
  "/api/offers": {
   "get": {
    "operationId": "searchOffers",
    "summary": "Search offers",
    "description": "Offers publishers can run. payout is what RottenAds pays the publisher. Tracking links come with an approved publisher account.",
    "parameters": [
     {"name": "query", "in": "query", "schema": {"type": "string"}, "description": "Words in the name, vertical or restrictions"},
     {"name": "vertical", "in": "query", "schema": {"type": "string"}, "example": "Telehealth"},
     {"name": "traffic", "in": "query", "schema": {"type": "string"}, "example": "Email"},
     {"name": "geo", "in": "query", "schema": {"type": "string"}, "description": "Two-letter country code", "example": "US"},
     {"name": "model", "in": "query", "schema": {"type": "string", "enum": ["CPL", "CPA", "CPS", "RevShare"]}},
     {"name": "min_payout", "in": "query", "schema": {"type": "number"}},
     {"name": "limit", "in": "query", "schema": {"type": "integer", "minimum": 1, "maximum": 50, "default": 20}},
     {"name": "id", "in": "query", "schema": {"type": "integer"}, "description": "Return one offer by id"}
    ],
    "responses": {"200": {"description": "Matching offers", "content": {"application/json": {"schema": {"type": "object", "properties": {
     "updated": {"type": "string"}, "total": {"type": "integer"}, "offers": {"type": "array", "items": {"$ref": "#/components/schemas/Offer"}}}}}}}}
   }
  },
  "/api/apply": {
   "post": {
    "operationId": "apply",
    "summary": "Apply as a publisher or an advertiser",
    "description": "Send it with the applicant's real details and consent. Max 5 applications per hour per IP.",
    "requestBody": {"required": true, "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Application"}}}},
    "responses": {
     "202": {"description": "Received", "content": {"application/json": {"schema": {"type": "object", "properties": {
      "ok": {"type": "boolean"}, "status": {"type": "string", "example": "received"}, "reference": {"type": "string"},
      "role": {"type": "string"}, "next_steps": {"type": "string"}}}}}},
     "400": {"description": "Missing or invalid fields (errors[])"},
     "429": {"description": "Rate limited"}
    }
   }
  }
 },
 "components": {"schemas": {
  "Offer": {"type": "object", "properties": {
   "id": {"type": "integer"}, "name": {"type": "string"}, "vertical": {"type": "string"},
   "payout": {"type": "string", "example": "$45.00 CPA"}, "payout_amount": {"type": "number"},
   "payout_type": {"type": "string", "enum": ["fixed", "revshare_percent"]}, "currency": {"type": "string"},
   "model": {"type": "string"}, "geos": {"type": "array", "items": {"type": "string"}},
   "traffic": {"type": "array", "items": {"type": "string"}}, "restrictions": {"type": "string"},
   "converting_now": {"type": "boolean"}, "top_pick": {"type": "boolean"}, "url": {"type": "string"}, "apply_url": {"type": "string"}}},
  "Application": {"type": "object", "required": ["role", "name", "email"], "properties": {
   "role": {"type": "string", "enum": ["publisher", "advertiser"]},
   "name": {"type": "string"}, "email": {"type": "string", "format": "email"}, "company": {"type": "string"},
   "telegram": {"type": "string"}, "website": {"type": "string"}, "country": {"type": "string"}, "message": {"type": "string"},
   "agent_name": {"type": "string", "description": "If an AI agent applies on someone's behalf: its name/product"},
   "traffic_types": {"type": "array", "items": {"type": "string"}, "description": "Publisher (required): Email, SMS, Meta, TikTok, Native, Display, Search, Push, Path. Advertiser: allowed traffic."},
   "geos": {"type": "array", "items": {"type": "string"}}, "verticals": {"type": "array", "items": {"type": "string"}},
   "monthly_volume": {"type": "string"}, "list_and_consent": {"type": "string"},
   "offer_ids": {"type": "array", "items": {"type": "integer"}},
   "offer": {"type": "string", "description": "Advertiser (required): what to promote"}, "payout": {"type": "string"},
   "caps": {"type": "string"}, "tracker": {"type": "string"}, "offer_url": {"type": "string"}}}
 }}
}
