{
  "openapi": "3.1.0",
  "info": {
    "title": "Dataconto Buyer Database API",
    "version": "1.0.0",
    "summary": "Who pays owners for company records and private code: programs, published payouts, rates, fees, eligibility and payment timing, each quoted from the buyer's own page with the date read.",
    "description": "The open buyer database behind dataconto.com/open-data, as JSON. No sign-up or API key. One row per program with its current facts, and a second endpoint with every dated fact including superseded ones. Figures are the buyer's own words; nothing is averaged or estimated. Introducer and partner terms are left out by rule. If you show this data, credit Dataconto with a link to https://dataconto.com/open-data.",
    "contact": { "name": "Dataconto", "url": "https://dataconto.com/open-data", "email": "contact@dataconto.com" },
    "license": { "name": "CC BY 4.0", "identifier": "CC-BY-4.0" }
  },
  "externalDocs": { "description": "Human-readable docs, downloads and method", "url": "https://dataconto.com/open-data" },
  "servers": [{ "url": "https://dataconto.com" }],
  "security": [],
  "paths": {
    "/api/buyers.json": {
      "get": {
        "operationId": "listPrograms",
        "summary": "List buyer programs",
        "description": "Programs that pay owners for company records or code, with a payout summary, per-unit rates and their current facts. Page with limit and offset; each response gives total and next_offset.",
        "parameters": [
          { "name": "side", "in": "query", "description": "code: programs that take private code. company: programs that take company records. Programs that take both match either.", "schema": { "type": "string", "enum": ["company", "code"] } },
          { "name": "kind", "in": "query", "description": "pays_owner: the program is the counterparty and pays the owner itself. marketplace: the owner is paid out of a third party's purchase. invite_only: no public way in.", "schema": { "type": "string", "enum": ["pays_owner", "marketplace", "invite_only"] } },
          { "name": "status", "in": "query", "schema": { "type": "string", "enum": ["open", "invite", "paused", "closed"] } },
          { "name": "country", "in": "query", "description": "Two-letter ISO 3166 code. Keeps programs that name the country and programs that name no country at all.", "schema": { "type": "string", "pattern": "^[A-Za-z]{2}$" } },
          { "name": "min_payout", "in": "query", "description": "Whole US dollars. Keeps programs whose published top figure is at least this, or whose range is open-ended.", "schema": { "type": "integer", "minimum": 0 } },
          { "name": "listed", "in": "query", "description": "true: only programs Dataconto routes owners to. false: only the rest.", "schema": { "type": "boolean" } },
          { "name": "id", "in": "query", "description": "One program id.", "schema": { "type": "string", "pattern": "^[a-z0-9-]{1,80}$" } },
          { "name": "facts", "in": "query", "description": "false drops each program's facts array and keeps the summary.", "schema": { "type": "boolean", "default": true } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 200, "default": 100 } },
          { "$ref": "#/components/parameters/offset" }
        ],
        "responses": {
          "200": {
            "description": "A page of programs.",
            "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/Page" }, { "type": "object", "properties": { "programs": { "type": "array", "items": { "$ref": "#/components/schemas/Program" } } }, "required": ["programs"] }] } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" }
        }
      }
    },
    "/api/facts.json": {
      "get": {
        "operationId": "listFacts",
        "summary": "List dated facts",
        "description": "Every fact in the database, history included. A fact is one verbatim quote from one source on one date. A replaced fact keeps current: false and the new one names it in supersedes.",
        "parameters": [
          { "name": "program", "in": "query", "schema": { "type": "string", "pattern": "^[a-z0-9-]{1,80}$" } },
          { "name": "field", "in": "query", "schema": { "type": "string", "enum": ["payout_range", "payout_rate", "payout_cap", "payout_total", "platform_fee", "payment_timing", "exclusivity", "eligibility", "buys", "process", "deal", "ownership"] } },
          { "name": "source_type", "in": "query", "schema": { "type": "string", "enum": ["primary", "press", "register"] } },
          { "name": "since", "in": "query", "description": "Observed on or after this date.", "schema": { "type": "string", "format": "date" } },
          { "name": "current", "in": "query", "schema": { "type": "boolean" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 200, "default": 200 } },
          { "$ref": "#/components/parameters/offset" }
        ],
        "responses": {
          "200": {
            "description": "A page of facts.",
            "content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/Page" }, { "type": "object", "properties": { "facts": { "type": "array", "items": { "$ref": "#/components/schemas/Fact" } } }, "required": ["facts"] }] } } }
          },
          "400": { "$ref": "#/components/responses/BadRequest" }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "offset": { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } }
    },
    "responses": {
      "BadRequest": {
        "description": "A parameter was malformed. The body names it.",
        "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" }, "docs": { "type": "string", "format": "uri" } }, "required": ["error"] } } }
      }
    },
    "schemas": {
      "Page": {
        "type": "object",
        "properties": {
          "license": { "type": "string", "const": "CC-BY-4.0" },
          "license_url": { "type": "string", "format": "uri" },
          "attribution": { "type": "string" },
          "docs": { "type": "string", "format": "uri" },
          "dataset": { "type": "string" },
          "version": { "type": "string", "format": "date", "description": "The source file's updated date." },
          "generated_at": { "type": "string", "format": "date-time" },
          "total": { "type": "integer" },
          "returned": { "type": "integer" },
          "limit": { "type": "integer" },
          "offset": { "type": "integer" },
          "next_offset": { "type": ["integer", "null"] }
        },
        "required": ["license", "attribution", "total", "returned", "limit", "offset", "next_offset"]
      },
      "Value": {
        "type": "object",
        "description": "A figure as the buyer gives it. Money is low to high in currency per unit; plus means the buyer says 'and above'. A fee is a percent.",
        "properties": {
          "low": { "type": ["number", "null"] },
          "high": { "type": ["number", "null"] },
          "plus": { "type": "boolean" },
          "currency": { "type": ["string", "null"], "description": "ISO 4217, e.g. USD, INR." },
          "unit": { "type": ["string", "null"], "enum": ["per_license", "per_repo", "per_pr", "per_artifact", "per_1m_tokens_source", "per_1m_tokens_history", "per_company", "one_time", "percent_of_payout", "percent_of_sale", "total", "illustrative_total", "none", null] },
          "percent": { "type": ["number", "null"] }
        }
      },
      "Fact": {
        "type": "object",
        "properties": {
          "fact_id": { "type": "string" },
          "program": { "type": "string", "description": "Program id." },
          "field": { "type": "string" },
          "value": { "$ref": "#/components/schemas/Value" },
          "quote": { "type": "string", "description": "The source's own words." },
          "source_url": { "type": "string", "format": "uri" },
          "source_label": { "type": "string" },
          "source_type": { "type": "string", "enum": ["primary", "press", "register"] },
          "observed": { "type": "string", "format": "date", "description": "The day the source was read." },
          "supersedes": { "type": ["string", "null"], "description": "fact_id of the row this one replaces." },
          "current": { "type": "boolean" },
          "note": { "type": ["string", "null"] },
          "primary_note": { "type": ["string", "null"], "description": "On press and register rows: what the program's own page says, or why there is none." }
        },
        "required": ["fact_id", "program", "field", "value", "quote", "source_url", "source_type", "observed", "current"]
      },
      "Program": {
        "type": "object",
        "properties": {
          "id": { "type": "string" },
          "company": { "type": "string" },
          "program": { "type": "string" },
          "side": { "type": "string", "enum": ["company", "code", "both"] },
          "kind": { "type": "string", "enum": ["pays_owner", "marketplace", "invite_only"] },
          "status": { "type": "string", "enum": ["open", "invite", "paused", "closed"] },
          "url": { "type": "string", "format": "uri", "description": "The program's own page." },
          "countries": { "type": ["array", "null"], "items": { "type": "string" }, "description": "ISO 3166 codes the program names; null when it names none." },
          "summary": { "type": "string" },
          "eligibility_summary": { "type": ["string", "null"] },
          "payout_usd": {
            "type": "object",
            "description": "The widest current primary figure in USD per license, repository, company or payment. Null when the buyer quotes case by case or publishes only a per-unit rate.",
            "properties": { "low": { "type": ["number", "null"] }, "high": { "type": ["number", "null"] }, "unit": { "type": ["string", "null"] }, "open_ended": { "type": "boolean" } }
          },
          "rates": { "type": "array", "items": { "type": "object", "properties": { "usd": { "type": "number" }, "unit": { "type": "string" }, "fact_id": { "type": "string" } } } },
          "listed_on_site": { "type": "boolean", "description": "Whether Dataconto has a buyer page for it and routes owners there." },
          "site_url": { "type": ["string", "null"], "format": "uri" },
          "checked": { "type": "string", "format": "date", "description": "The day the program's page was last read." },
          "facts": { "type": "array", "items": { "$ref": "#/components/schemas/Fact" }, "description": "Current facts only. Superseded rows are on /api/facts.json." },
          "fact_count": { "type": "integer", "description": "All facts for the program, history included." },
          "notes": { "type": ["string", "null"] }
        },
        "required": ["id", "company", "program", "side", "kind", "status", "url", "summary", "payout_usd", "rates", "listed_on_site", "checked", "facts"]
      }
    }
  }
}
