{
  "openapi": "3.1.0",
  "info": {
    "title": "MediaPR Database API",
    "version": "1.0.0",
    "description": "Search and export news outlets, podcasts and newsletters with contact emails."
  },
  "servers": [
    {
      "url": "https://mediaprdatabase.com/api/v1"
    }
  ],
  "components": {
    "securitySchemes": {
      "key": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  },
  "security": [
    {
      "key": []
    },
    {}
  ],
  "paths": {
    "/search": {
      "get": {
        "operationId": "search",
        "summary": "Search media. Emails masked without a Pro/Premium key.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "continent",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "region",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "city",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "coverage",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "city_size",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "named",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Results"
          }
        }
      }
    },
    "/facets": {
      "get": {
        "operationId": "facets",
        "summary": "Available countries, kinds, types, categories with counts",
        "responses": {
          "200": {
            "description": "Facets"
          }
        }
      }
    },
    "/export": {
      "get": {
        "operationId": "export",
        "summary": "Pro/Premium: CSV download of news outlets (no filters = all). Premium: also kind=podcast|newsletter and instantly/smartlead/lemlist formats",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "continent",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "region",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "city",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "coverage",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "city_size",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "named",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "instantly",
                "smartlead",
                "lemlist"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CSV file"
          }
        }
      }
    },
    "/export/push": {
      "post": {
        "operationId": "pushToTool",
        "summary": "Premium: push leads into an Instantly or Smartlead campaign",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tool",
                  "api_key",
                  "campaign_id"
                ],
                "properties": {
                  "tool": {
                    "type": "string",
                    "enum": [
                      "instantly",
                      "smartlead"
                    ]
                  },
                  "api_key": {
                    "type": "string"
                  },
                  "campaign_id": {
                    "type": "string"
                  },
                  "filters": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pushed"
          }
        }
      }
    },
    "/checkout": {
      "post": {
        "operationId": "checkout",
        "summary": "Start a purchase; returns checkout_url, order_id, claim_token",
        "security": [
          {}
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "tier"
                ],
                "properties": {
                  "tier": {
                    "type": "string",
                    "enum": [
                      "pro",
                      "premium"
                    ]
                  },
                  "email": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checkout started"
          }
        }
      }
    },
    "/orders/{id}": {
      "get": {
        "operationId": "order",
        "summary": "Order status; returns api_key once after payment",
        "security": [
          {}
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "claim_token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Order"
          }
        }
      }
    },
    "/me": {
      "get": {
        "operationId": "me",
        "summary": "Current plan and expiry",
        "responses": {
          "200": {
            "description": "Account"
          }
        }
      }
    }
  }
}