{
  "openapi": "3.1.0",
  "info": {
    "title": "Willow Rock Data Tools",
    "version": "1.0.0",
    "x-guidance": "Deterministic table tools. POST JSON {\"data\": <CSV/TSV/JSONL/Markdown string or array of objects>, \"format\"?: ..., plus \"options\" (clean-csv), \"schema\" (validate-data) or \"to\" (convert-format)} to /api/v1/<service>. The first call returns HTTP 402 with an MPP stripe/charge challenge (card via Shared Payment Token); retry with the credential to get the result. Bad input is rejected before any charge. Prices: clean-csv $1.00, validate-data $0.75, convert-format $0.50 per call. Free previews: POST the same body plus \"service\" to /api/v1/jobs. Limits 64 KB / 1000 rows.",
    "description": "Pay-per-job table tools by Willow Rock Holdings. Payments: Machine Payments Protocol (HTTP 402) with Stripe card SPTs.",
    "contact": {
      "email": "willowrockholdingsllc@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://willow-rock-data-tools.willowrock.workers.dev"
    }
  ],
  "x-service-info": {
    "categories": [
      "data",
      "developer-tools",
      "productivity"
    ],
    "docs": {
      "homepage": "https://willow-rock-data-tools.willowrock.workers.dev/",
      "llms": "https://willow-rock-data-tools.willowrock.workers.dev/llms.txt",
      "apiReference": "https://willow-rock-data-tools.willowrock.workers.dev/openapi.json"
    }
  },
  "paths": {
    "/api/v1/clean-csv": {
      "post": {
        "operationId": "clean_csv",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "1.00"
          },
          "protocols": [
            {
              "mpp": {
                "method": "stripe",
                "intent": "charge",
                "currency": "usd"
              }
            }
          ]
        },
        "summary": "CSV / spreadsheet cleanup to typed JSON ($1.00 per call)",
        "description": "Cleans a messy CSV/TSV/JSON table: auto-detects delimiter, snake_cases and de-duplicates headers, trims whitespace, turns blanks/\"N/A\" into null, drops empty rows/columns and exact duplicate rows, infers integers/numbers/booleans, converts dates to ISO 8601, lowercases emails and formats US phone numbers as E.164. Returns typed JSON rows (or CSV/JSONL/TSV/Markdown/HTML) plus a per-column report.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    ]
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "csv",
                      "tsv",
                      "json",
                      "jsonl",
                      "markdown"
                    ]
                  },
                  "options": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result; Payment-Receipt header attached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "result": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad input (never charged)."
          },
          "402": {
            "description": "Payment required: WWW-Authenticate: Payment challenge (MPP, stripe/charge, card SPT)."
          },
          "413": {
            "description": "Too large (never charged)."
          }
        }
      }
    },
    "/api/v1/validate-data": {
      "post": {
        "operationId": "validate_data",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.75"
          },
          "protocols": [
            {
              "mpp": {
                "method": "stripe",
                "intent": "charge",
                "currency": "usd"
              }
            }
          ]
        },
        "summary": "Data validation against a column schema ($0.75 per call)",
        "description": "Checks every row of a CSV/TSV/JSON/JSONL table against a simple column schema (type: string|integer|number|boolean|date|email|url|phone; required; unique; min/max; minLength/maxLength; pattern; enum). Returns a pass/fail verdict, invalid-row count, counts per column and rule, and up to 1,000 row-level issues with messages.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    ]
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "csv",
                      "tsv",
                      "json",
                      "jsonl",
                      "markdown"
                    ]
                  },
                  "schema": {
                    "type": "object",
                    "properties": {
                      "columns": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result; Payment-Receipt header attached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "result": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad input (never charged)."
          },
          "402": {
            "description": "Payment required: WWW-Authenticate: Payment challenge (MPP, stripe/charge, card SPT)."
          },
          "413": {
            "description": "Too large (never charged)."
          }
        }
      }
    },
    "/api/v1/convert-format": {
      "post": {
        "operationId": "convert_format",
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.50"
          },
          "protocols": [
            {
              "mpp": {
                "method": "stripe",
                "intent": "charge",
                "currency": "usd"
              }
            }
          ]
        },
        "summary": "Table format conversion ($0.50 per call)",
        "description": "Converts a table between formats. Input: csv, tsv, json, jsonl, markdown. Output: csv, tsv, json, jsonl, markdown, html. Nested JSON objects are flattened to dot.notation columns. Quoting and escaping are handled correctly (RFC 4180 CSV).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    ]
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "csv",
                      "tsv",
                      "json",
                      "jsonl",
                      "markdown"
                    ]
                  },
                  "to": {
                    "type": "string",
                    "enum": [
                      "csv",
                      "tsv",
                      "json",
                      "jsonl",
                      "markdown",
                      "html"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result; Payment-Receipt header attached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "service": {
                      "type": "string"
                    },
                    "summary": {
                      "type": "string"
                    },
                    "result": {}
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad input (never charged)."
          },
          "402": {
            "description": "Payment required: WWW-Authenticate: Payment challenge (MPP, stripe/charge, card SPT)."
          },
          "413": {
            "description": "Too large (never charged)."
          }
        }
      }
    },
    "/api/v1/jobs": {
      "post": {
        "operationId": "create_job",
        "security": [],
        "summary": "Free: run a job, get a preview, price and paymentLink",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "data"
                ],
                "properties": {
                  "data": {
                    "oneOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "array",
                        "items": {
                          "type": "object"
                        }
                      }
                    ]
                  },
                  "format": {
                    "type": "string",
                    "enum": [
                      "csv",
                      "tsv",
                      "json",
                      "jsonl",
                      "markdown"
                    ]
                  },
                  "service": {
                    "type": "string",
                    "enum": [
                      "clean-csv",
                      "validate-data",
                      "convert-format"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Job with preview and paymentLink"
          }
        }
      }
    },
    "/api/v1/jobs/{id}": {
      "get": {
        "operationId": "get_job",
        "security": [],
        "summary": "Job status, or the full result once paid",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Job"
          }
        }
      }
    },
    "/api/v1/jobs/{id}/pay": {
      "post": {
        "operationId": "pay_job",
        "security": [],
        "summary": "Pay for a job (MPP 402 flow); browsers are redirected to Stripe Checkout",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "The paymentLink returned when a job is created. Answers HTTP 402 (MPP stripe/charge, card SPT) for the job price until paid.",
        "responses": {
          "200": {
            "description": "Full result + Payment-Receipt"
          }
        }
      }
    }
  }
}