{
  "openapi": "3.1.0",
  "info": {
    "title": "LimitsDB API",
    "version": "1.0.0",
    "description": "Source-backed limits, quotas, pricing and capabilities for software services. Every fact carries provenance and a status. Timestamps are ISO 8601 UTC."
  },
  "servers": [
    {
      "url": "https://limitsdb.vortexhub.dev"
    }
  ],
  "paths": {
    "/api/public/v1/providers": {
      "get": {
        "summary": "Provider index",
        "operationId": "listProviders",
        "responses": {
          "200": {
            "description": "Provider list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/providers/{slug}": {
      "get": {
        "summary": "Structured provider payload with all published facts",
        "operationId": "getProvider",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Provider with facts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No matching record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/facts": {
      "get": {
        "summary": "Atomic facts with provenance",
        "operationId": "listFacts",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "product",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "plan",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "verified",
                "stale",
                "conflicting",
                "removed"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching facts",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "object": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Fact"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No matching record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/compare": {
      "get": {
        "summary": "Deterministic comparison of two providers on shared keys",
        "operationId": "compareProviders",
        "parameters": [
          {
            "name": "a",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "b",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "key",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Comparison rows",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No matching record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/changes": {
      "get": {
        "summary": "Recently detected material changes",
        "operationId": "listChanges",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Change list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No matching record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/keys": {
      "get": {
        "summary": "Canonical fact keys with coverage counts",
        "operationId": "listKeys",
        "responses": {
          "200": {
            "description": "Key list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No matching record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/v1/keys/{key}": {
      "get": {
        "summary": "One canonical key across all providers",
        "operationId": "getKey",
        "parameters": [
          {
            "name": "key",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Key detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Malformed query",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No matching record",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/data/snapshot.jsonl": {
      "get": {
        "summary": "Bulk snapshot, one fact per line",
        "operationId": "getSnapshot",
        "responses": {
          "200": {
            "description": "JSONL snapshot",
            "content": {
              "application/jsonl": {}
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Fact": {
        "type": "object",
        "required": [
          "id",
          "key",
          "value",
          "datatype",
          "status",
          "source"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "provider": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "product": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "plan": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "key": {
            "type": "string"
          },
          "value": {
            "oneOf": [
              {
                "type": "number"
              },
              {
                "type": "string"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ]
          },
          "datatype": {
            "type": "string",
            "enum": [
              "integer",
              "decimal",
              "boolean",
              "string",
              "enum",
              "money"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "raw_value": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "verified",
              "stale",
              "conflicting",
              "removed"
            ]
          },
          "observed_at": {
            "type": "string",
            "format": "date-time"
          },
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "effective_to": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "last_verified_at": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "title": {
                "type": "string"
              },
              "source_type": {
                "type": "string"
              },
              "retrieved_at": {
                "type": "string",
                "format": "date-time"
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "FACT_NOT_FOUND",
                  "PROVIDER_NOT_FOUND",
                  "MISSING_PARAMETER",
                  "INVALID_LIMIT",
                  "INVALID_STATUS"
                ]
              },
              "message": {
                "type": "string"
              },
              "suggestions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  }
}