{
  "openapi": "3.1.0",
  "info": {
    "title": "Peepjam placement discovery",
    "version": "1.0.0",
    "description": "Free public read-only discovery for advertising placements. Cite peepjamUrl and the publisher source with checked. Preserve currency, billing unit, availability and minimum spend. A null price requires a quote."
  },
  "servers": [
    {
      "url": "https://peepjam.site"
    }
  ],
  "security": [],
  "paths": {
    "/api/browse": {
      "get": {
        "operationId": "searchPlacements",
        "summary": "Search advertising placements",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Search publisher, placement, format and audience text.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "platform",
            "in": "query",
            "required": false,
            "description": "Exact platform from getFacets, e.g. Newsletters.",
            "schema": {
              "type": "string"
            },
            "example": "Newsletters"
          },
          {
            "name": "budget",
            "in": "query",
            "required": false,
            "description": "Maximum USD price and published minimum spend, or free. Quote-only rates are excluded.",
            "schema": {
              "type": "string"
            },
            "example": "250"
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "description": "Original currency, e.g. USD.",
            "schema": {
              "type": "string"
            },
            "example": "USD"
          },
          {
            "name": "unit",
            "in": "query",
            "required": false,
            "description": "Publisher billing unit, e.g. issue or month.",
            "schema": {
              "type": "string"
            },
            "example": "issue"
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "description": "Country or reach label from getFacets.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "basis",
            "in": "query",
            "required": false,
            "description": "Exact audience measure from the measurement.basis facet.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "Read effectiveSort and info. Price needs a currency and unit. Best value uses one comparable currency, unit and audience group. Global rank can be advanced by paid Boosts.",
            "schema": {
              "type": "string",
              "enum": [
                "ranked",
                "recent",
                "price",
                "value",
                "popular",
                "trending"
              ]
            },
            "example": "price"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Zero-based offset. Add the number of returned rows for the next page.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000
            }
          },
          {
            "name": "limit",
            "description": "Rows to return. Use a small limit for a chat shortlist.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 40,
              "default": 40
            },
            "in": "query",
            "required": false,
            "example": 3
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResult"
                }
              }
            }
          }
        }
      }
    },
    "/api/placement": {
      "get": {
        "operationId": "getPlacement",
        "summary": "Read one placement, its source and booking destination",
        "parameters": [
          {
            "name": "id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Placement"
                }
              }
            }
          },
          "404": {
            "description": "Unknown, withdrawn or unavailable placement"
          }
        }
      }
    },
    "/api/facets": {
      "get": {
        "operationId": "getFacets",
        "summary": "List supported filters and current directory counts",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Facets"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Placement": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "product": {
            "type": "string"
          },
          "publisher": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "platform": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "rank": {
            "type": "integer",
            "description": "Global position. Paid Boosts can change it."
          },
          "boosted": {
            "type": "boolean"
          },
          "price": {
            "type": [
              "number",
              "null"
            ],
            "description": "Published starting unit price. Null means request a quote. Zero means explicitly free."
          },
          "upper": {
            "type": [
              "number",
              "null"
            ]
          },
          "conditional": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "True when the published starting price has conditions."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "minimum": {
            "type": [
              "number",
              "null"
            ]
          },
          "minimumCurrency": {
            "type": [
              "string",
              "null"
            ]
          },
          "availability": {
            "type": "string"
          },
          "measurement": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "amount": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "basis": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "valueEligible": {
                "type": "boolean"
              }
            }
          },
          "source": {
            "type": "string",
            "format": "uri",
            "description": "Publisher evidence. Check the source before booking."
          },
          "booking": {
            "type": "string",
            "format": "uri",
            "description": "Seller destination, sometimes an email link."
          },
          "checked": {
            "type": "string",
            "format": "date"
          },
          "peepjamUrl": {
            "type": "string",
            "format": "uri",
            "description": "Canonical Peepjam link to cite and share."
          }
        },
        "required": [
          "id",
          "product",
          "publisher",
          "title",
          "platform",
          "rank",
          "price",
          "source",
          "booking",
          "checked",
          "peepjamUrl"
        ]
      },
      "SearchResult": {
        "type": "object",
        "properties": {
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Placement"
            }
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "effectiveSort": {
            "type": "string"
          },
          "valueAvailable": {
            "type": "boolean"
          },
          "info": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "rows",
          "total",
          "limit",
          "offset",
          "effectiveSort",
          "valueAvailable",
          "info"
        ]
      },
      "Facets": {
        "type": "object",
        "properties": {
          "platform": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "industry": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "audience": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "format": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "geo": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "route": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "availability": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "unit": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "currency": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "measurement.basis": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "count": {
            "type": "integer"
          },
          "publishers": {
            "type": "integer"
          }
        },
        "required": [
          "count",
          "publishers",
          "platform"
        ]
      }
    }
  }
}
