{
  "openapi": "3.1.0",
  "info": {
    "title": "Grove Data Check",
    "version": "1.0.0",
    "description": "Operator pilot. Deterministic CSV validation; no model calls, paid access, or wallet integration. CSV up to 1,000,000 UTF-8 bytes, 10,000 data rows, 100 columns. Entire JSON request up to 4,000,000 bytes. Raw CSV is processed in memory and is not deliberately stored by this service."
  },
  "servers": [
    {
      "url": "https://grove.g-datalabs.com"
    }
  ],
  "paths": {
    "/api/data-check": {
      "get": {
        "summary": "Read service limits and availability",
        "responses": {
          "200": {
            "description": "Service status"
          }
        }
      },
      "post": {
        "operationId": "checkGroveCSV",
        "summary": "Check an authorized CSV",
        "security": [
          {
            "operatorKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "csv",
                  "authorizedToProcess"
                ],
                "properties": {
                  "csv": {
                    "type": "string",
                    "description": "UTF-8 comma-delimited CSV with a header; quoted fields and LF/CRLF/CR supported. No NULs. No duplicate or empty column names."
                  },
                  "authorizedToProcess": {
                    "type": "boolean",
                    "const": true
                  },
                  "rules": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "expectedColumns": {
                        "type": "array",
                        "maxItems": 100,
                        "uniqueItems": true,
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "columns": {
                        "type": "array",
                        "maxItems": 100,
                        "items": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "name"
                          ],
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "string",
                                "number",
                                "integer",
                                "date",
                                "boolean"
                              ],
                              "default": "string"
                            },
                            "required": {
                              "type": "boolean",
                              "default": false
                            },
                            "unique": {
                              "type": "boolean",
                              "default": false
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "csv": "id,score\n1,10\n2,\n",
                "authorizedToProcess": true,
                "rules": {
                  "columns": [
                    {
                      "name": "id",
                      "type": "integer",
                      "unique": true,
                      "required": true
                    },
                    {
                      "name": "score",
                      "type": "number",
                      "required": true
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON report with summary, per-column metrics, bounded issue samples, input/rules hashes and declared rules. Findings do not make this an HTTP error. No raw cell values are returned."
          },
          "400": {
            "description": "Invalid CSV, rules, encoding or missing processing authorization"
          },
          "401": {
            "description": "Missing or invalid operator access key"
          },
          "413": {
            "description": "Input exceeds service limits"
          },
          "415": {
            "description": "Use application/json"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "operatorKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Grove operator access key. Never use a model-provider key."
      }
    }
  }
}
