{
  "openapi": "3.0.3",
  "info": {
    "title": "Bot-n-Stop Comparison API",
    "version": "1.1.0",
    "description": "One free comparison per installation while pilot slots last. Additional eligible reports cost 0.03 native USDC on Base through Coinbase x402. Submit only authorized non-sensitive records.",
    "contact": {
      "name": "Bot-n-Stop",
      "email": "botnstop@gmail.com",
      "url": "https://bot-n-shop.netlify.app"
    }
  },
  "servers": [
    {
      "url": "https://botsnacks-testnet-api.cozah.chatgpt.site"
    }
  ],
  "paths": {
    "/api/v1/free-first-report": {
      "get": {
        "operationId": "getFreeReportGuide",
        "summary": "Read current pilot limits and setup; no job is submitted",
        "responses": {
          "200": {
            "description": "Current guide and limits"
          }
        }
      },
      "post": {
        "operationId": "compareFreeReport",
        "summary": "Compare one authorized file pair or retrieve its identical prior result",
        "description": "Submits selected data and may consume the one distinct-job allowance. Keep a stable private 64-hex key and exact request body. Do not execute synthetic example unless you intend it to use the allowance.",
        "x-openai-isConsequential": true,
        "security": [
          {
            "PilotKey": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "job"
                ],
                "additionalProperties": false,
                "properties": {
                  "job": {
                    "$ref": "#/components/schemas/Job"
                  }
                }
              },
              "example": {
                "job": {
                  "source": {
                    "format": "csv",
                    "data": "id,sku,price\nA,BLUE,12.00\nB,RED,9.00"
                  },
                  "target": {
                    "format": "json",
                    "data": [
                      {
                        "id": "A",
                        "sku": "BLUE",
                        "price": "10.00"
                      }
                    ]
                  },
                  "key": {
                    "source": "id",
                    "target": "id"
                  },
                  "fields": [
                    {
                      "source": "sku",
                      "target": "sku",
                      "type": "exact"
                    },
                    {
                      "source": "price",
                      "target": "price",
                      "type": "decimal"
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "400": {
            "description": "Invalid request or installation key."
          },
          "405": {
            "description": "Use POST."
          },
          "413": {
            "description": "Request too large."
          },
          "415": {
            "description": "Use application/json."
          },
          "422": {
            "description": "Invalid or ambiguous inputs; allowance not consumed."
          },
          "409": {
            "description": "Different job already used this key; recover original request."
          },
          "429": {
            "description": "Pilot allowance unavailable or rate limit; do not rotate keys."
          },
          "500": {
            "description": "Unverified outcome; retain original request."
          },
          "502": {
            "description": "Unverified upstream outcome; retain original request."
          },
          "200": {
            "description": "Completed comparison. Differences may be present. No payment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "report"
                  ],
                  "properties": {
                    "charged": {
                      "type": "boolean",
                      "enum": [
                        false
                      ]
                    },
                    "report": {
                      "type": "object",
                      "required": [
                        "status"
                      ],
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "passed",
                            "issues_found",
                            "cannot_verify"
                          ]
                        },
                        "source_rows": {
                          "type": "integer"
                        },
                        "target_rows": {
                          "type": "integer"
                        },
                        "issue_count": {
                          "type": "integer"
                        },
                        "issues_truncated": {
                          "type": "boolean"
                        },
                        "issues": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "additionalProperties": true
                          }
                        }
                      },
                      "additionalProperties": true
                    }
                  },
                  "additionalProperties": true
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/live/verify-transform": {
      "get": {
        "operationId": "showLiveOffer",
        "summary": "Read the live price and schema for a public sample without paying",
        "responses": {
          "402": {
            "description": "Unsigned x402 v2 offer for 0.03 native USDC on Base."
          },
          "503": {
            "description": "Live checkout unavailable."
          }
        }
      },
      "post": {
        "operationId": "compareLive",
        "summary": "Quote, pay for, or recover one comparison on Base",
        "description": "Send an unsigned request for a free quote. Reuse the same body, key and signed header for retry or recovery. Submit a payment signature only with buyer authorization. The GET sample response includes the full accepted job schema.",
        "x-openai-isConsequential": true,
        "parameters": [
          {
            "in": "header",
            "name": "PAYMENT-SIGNATURE",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "x402 v2 buyer authorization, omitted for an unsigned quote."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "job",
                  "request_key"
                ],
                "properties": {
                  "job": {
                    "type": "object",
                    "description": "Comparison job with source and target datasets, key mapping, and fields. See the live GET offer for the complete schema."
                  },
                  "request_key": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{43,128}$",
                    "writeOnly": true,
                    "description": "Generate from at least 32 random bytes per new job."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Paid report and receipt, including a recovered result."
          },
          "202": {
            "description": "Payment pending. Preserve the original signed request."
          },
          "402": {
            "description": "Payment required. Inspect the exact offer before signing."
          },
          "429": {
            "description": "Usage limit reached."
          },
          "503": {
            "description": "Checkout unavailable."
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "PilotKey": {
        "type": "apiKey",
        "in": "header",
        "name": "BotNStop-Pilot-Key",
        "description": "Generate 32 random bytes locally once. Retain privately as 64 lowercase hex characters. Not a vendor-issued account credential. Never rotate to evade allowance."
      }
    },
    "schemas": {
      "Dataset": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "format",
              "data"
            ],
            "additionalProperties": false,
            "properties": {
              "format": {
                "type": "string",
                "enum": [
                  "csv"
                ]
              },
              "data": {
                "type": "string",
                "description": "CSV with header and string cells."
              }
            }
          },
          {
            "type": "object",
            "required": [
              "format",
              "data"
            ],
            "additionalProperties": false,
            "properties": {
              "format": {
                "type": "string",
                "enum": [
                  "json"
                ]
              },
              "data": {
                "type": "array",
                "maxItems": 100,
                "items": {
                  "type": "object",
                  "additionalProperties": {
                    "type": "string"
                  }
                }
              }
            }
          }
        ]
      },
      "Field": {
        "type": "object",
        "required": [
          "source",
          "target",
          "type"
        ],
        "additionalProperties": false,
        "properties": {
          "source": {
            "type": "string",
            "minLength": 1
          },
          "target": {
            "type": "string",
            "minLength": 1
          },
          "type": {
            "type": "string",
            "enum": [
              "exact",
              "text",
              "decimal"
            ]
          },
          "trim": {
            "type": "boolean",
            "description": "Optional for text comparison."
          }
        }
      },
      "Job": {
        "type": "object",
        "required": [
          "source",
          "target",
          "key",
          "fields"
        ],
        "additionalProperties": false,
        "properties": {
          "source": {
            "$ref": "#/components/schemas/Dataset"
          },
          "target": {
            "$ref": "#/components/schemas/Dataset"
          },
          "key": {
            "type": "object",
            "required": [
              "source",
              "target"
            ],
            "additionalProperties": false,
            "properties": {
              "source": {
                "type": "string",
                "minLength": 1
              },
              "target": {
                "type": "string",
                "minLength": 1
              }
            }
          },
          "fields": {
            "type": "array",
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/Field"
            }
          }
        },
        "description": "At most 100 rows per side and 65536 bytes total request. Unique nonempty string IDs, string values only; project unselected columns out. Decimal values must be plain decimal strings."
      }
    }
  }
}
