{
  "openapi": "3.1.0",
  "info": {
    "title": "KirchnerData Licensed Research API",
    "version": "1.0.0",
    "description": "Read the authenticated schema first. Query only bols. Every request enforces your current licensed dates and columns. Monthly averaged unit value is an estimate in USD/kg. Public analytics APIs are separate."
  },
  "servers": [
    {
      "url": "https://www.kirchnerdata.com"
    }
  ],
  "security": [
    {
      "ResearchKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "ResearchKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Create a personal key at /account#research-api. Never include it in chat or query strings."
      }
    }
  },
  "paths": {
    "/api/research/access": {
      "get": {
        "operationId": "getResearchAccess",
        "description": "Get the current licensed arrival-date window, column packs and request limits.",
        "responses": {
          "200": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "422": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/research/schema": {
      "get": {
        "operationId": "getResearchSchema",
        "description": "Read this first: permitted table columns with types, descriptions, units, licensed dates and example SQL.",
        "responses": {
          "200": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "422": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/research/query": {
      "post": {
        "operationId": "queryResearchData",
        "description": "Run one SELECT or WITH query against bols. Licensed dates and columns are enforced by the server in every scan. Max 500 rows; inspect truncated. No external tables, table functions or SETTINGS.",
        "responses": {
          "200": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "400": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "401": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "422": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "429": {
            "description": "JSON response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sql": {
                    "type": "string",
                    "maxLength": 32000
                  }
                },
                "required": [
                  "sql"
                ],
                "additionalProperties": false
              }
            }
          }
        }
      }
    }
  }
}
