{
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "description": "API key (lk_live_..., lk_test_..., or lk_pub_...)",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Read-only access to tenant-owned product catalog and compliance status. Create API keys in LOCURA Hub and grant only the required Validator scopes.",
    "title": "LOCURA Validator API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/compliance": {
      "get": {
        "description": "Returns the current materialized compliance result per tenant-owned SKU without run IDs or internal record identifiers.",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Case-insensitive search in SKU, SKU name and product name.",
            "in": "query",
            "name": "q",
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Exact SKU code.",
            "in": "query",
            "name": "sku",
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Exact catalog group code.",
            "in": "query",
            "name": "group",
            "schema": {
              "maxLength": 32,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Exact catalog subgroup code.",
            "in": "query",
            "name": "subgroup",
            "schema": {
              "maxLength": 32,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Exact compliance status.",
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "compliant",
                "gaps",
                "review_needed",
                "unknown",
                "out_of_scope"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "evaluated_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "group": {
                            "anyOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "name"
                                ],
                                "type": "object"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "lifecycle_status": {
                            "anyOf": [
                              {
                                "enum": [
                                  "Aktywny",
                                  "Archiwalny",
                                  "Schyłkowy",
                                  "Planowany",
                                  "Blokada"
                                ],
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "missing_standards": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "name": {
                            "type": "string"
                          },
                          "product_name": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sku": {
                            "type": "string"
                          },
                          "status": {
                            "enum": [
                              "compliant",
                              "gaps",
                              "review_needed",
                              "unknown",
                              "out_of_scope"
                            ],
                            "type": "string"
                          },
                          "subgroup": {
                            "anyOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "name"
                                ],
                                "type": "object"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "sku",
                          "name",
                          "lifecycle_status",
                          "product_name",
                          "group",
                          "subgroup",
                          "status",
                          "missing_standards",
                          "evaluated_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "pagination": {
                      "additionalProperties": false,
                      "properties": {
                        "page": {
                          "minimum": 1,
                          "type": "integer"
                        },
                        "per_page": {
                          "maximum": 100,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "total": {
                          "minimum": 0,
                          "type": "integer"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List tenant SKU compliance status",
        "tags": [
          "Compliance"
        ],
        "x-required-scope": "validator:compliance:read"
      }
    },
    "/api/v1/health": {
      "get": {
        "description": "Returns database, indexing backlog and local embedding service health.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "app": {
                      "const": "validator",
                      "type": "string"
                    },
                    "checks": {
                      "properties": {
                        "db": {
                          "properties": {
                            "message": {
                              "type": "string"
                            },
                            "ok": {
                              "type": "boolean"
                            },
                            "pendingIndexDocuments": {
                              "minimum": 0,
                              "type": "integer"
                            }
                          },
                          "required": [
                            "ok"
                          ],
                          "type": "object"
                        },
                        "embeddings": {
                          "additionalProperties": true,
                          "type": "object"
                        }
                      },
                      "required": [
                        "db",
                        "embeddings"
                      ],
                      "type": "object"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "status": {
                      "enum": [
                        "ok",
                        "degraded",
                        "down"
                      ],
                      "type": "string"
                    },
                    "timestamp": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "version": {
                      "const": "0.1.0",
                      "type": "string"
                    }
                  },
                  "required": [
                    "ok",
                    "status",
                    "app",
                    "version",
                    "timestamp",
                    "checks"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "500": {
            "description": "Internal server error"
          },
          "503": {
            "description": "The database is unavailable."
          }
        },
        "security": [],
        "summary": "Check Validator service health",
        "tags": [
          "Meta"
        ]
      }
    },
    "/api/v1/products": {
      "get": {
        "description": "Returns a paginated tenant-owned catalog projection without internal identifiers, notes or storage metadata.",
        "parameters": [
          {
            "in": "query",
            "name": "page",
            "schema": {
              "default": 1,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "per_page",
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Case-insensitive search in SKU, SKU name and product name.",
            "in": "query",
            "name": "q",
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Exact SKU code.",
            "in": "query",
            "name": "sku",
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Exact catalog group code.",
            "in": "query",
            "name": "group",
            "schema": {
              "maxLength": 32,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Exact catalog subgroup code.",
            "in": "query",
            "name": "subgroup",
            "schema": {
              "maxLength": 32,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Exact SKU lifecycle status.",
            "in": "query",
            "name": "status",
            "schema": {
              "enum": [
                "Aktywny",
                "Archiwalny",
                "Schyłkowy",
                "Planowany",
                "Blokada"
              ],
              "type": "string"
            }
          },
          {
            "description": "Filter prototype SKUs.",
            "in": "query",
            "name": "is_prototype",
            "schema": {
              "enum": [
                "true",
                "false",
                "1",
                "0"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "data": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "description": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "group": {
                            "anyOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "name"
                                ],
                                "type": "object"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "is_prototype": {
                            "type": "boolean"
                          },
                          "lifecycle_status": {
                            "anyOf": [
                              {
                                "enum": [
                                  "Aktywny",
                                  "Archiwalny",
                                  "Schyłkowy",
                                  "Planowany",
                                  "Blokada"
                                ],
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "power": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "product": {
                            "anyOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "description": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "name",
                                  "description"
                                ],
                                "type": "object"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sales_unit": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "sku": {
                            "type": "string"
                          },
                          "subgroup": {
                            "anyOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "name"
                                ],
                                "type": "object"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "updated_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "voltage": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "sku",
                          "name",
                          "description",
                          "lifecycle_status",
                          "is_prototype",
                          "sales_unit",
                          "voltage",
                          "power",
                          "product",
                          "group",
                          "subgroup",
                          "updated_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "pagination": {
                      "additionalProperties": false,
                      "properties": {
                        "page": {
                          "minimum": 1,
                          "type": "integer"
                        },
                        "per_page": {
                          "maximum": 100,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "total": {
                          "minimum": 0,
                          "type": "integer"
                        }
                      },
                      "required": [
                        "page",
                        "per_page",
                        "total"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "data",
                    "pagination"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "401": {
            "description": "Unauthorized - missing or invalid API key"
          },
          "403": {
            "description": "Forbidden - missing required scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "List tenant products and SKUs",
        "tags": [
          "Products"
        ],
        "x-required-scope": "validator:products:read"
      }
    }
  },
  "servers": [
    {
      "url": "https://validator.locura.tech"
    }
  ]
}
