{"openapi":"3.1.0","info":{"title":"TinyData API","version":"1.0.0","description":"Pay-per-call text hashing, Base64 conversion, and CSV cleanup. Protected requests use x402 v2 and settle in USDC on Polygon only after successful responses.","x-guidance":"Use POST /api/clean-csv to trim, deduplicate, remove blank rows, or sort CSV data for $0.01. Use POST /api/batch-hash for 2–500 SHA-256/SHA-512 digests for $0.01. Use /api/hash or /api/encode for one-off text tasks for $0.001. Send application/json. Successful requests are paid in USDC through x402 v2 on Polygon. Inputs are not stored."},"security":[{"x402":[]}],"externalDocs":{"description":"TinyData API usage and endpoint guide","url":"https://cleanrows-api.lyra-lavende-7298.chatgpt.site/#docs"},"servers":[{"url":"https://cleanrows-api.lyra-lavende-7298.chatgpt.site"}],"tags":[{"name":"hashing","description":"SHA and HMAC text hashing"},{"name":"encoding","description":"Base64 and Base64URL conversion"},{"name":"csv","description":"CSV row cleanup"}],"paths":{"/api/hash":{"post":{"operationId":"hashText","x-payment-info":{"protocols":"x402","price":{"mode":"fixed","currency":"USD","amount":"0.001"}},"tags":["hashing"],"summary":"Hash one string or a batch","description":"Computes SHA-256, SHA-512, or HMAC-SHA-256. Costs $0.001 USDC on Polygon per successful request.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HashInput"}}}},"responses":{"200":{"description":"Hex digest or ordered list of digests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HashOutput"}}}},"400":{"description":"Invalid JSON input, algorithm, or HMAC key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Payment required. Follow the x402 v2 challenge before retrying the request.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 v2 payment requirements, including the amount, USDC asset, Polygon network, and receiving wallet.","schema":{"type":"string"}}}},"503":{"description":"The payment facilitator is temporarily unavailable. Retry later; no payment was settled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/encode":{"post":{"operationId":"convertBase64","x-payment-info":{"protocols":"x402","price":{"mode":"fixed","currency":"USD","amount":"0.001"}},"tags":["encoding"],"summary":"Encode or decode Base64 text","description":"Converts UTF-8 text to or from Base64 and Base64URL. Costs $0.001 USDC on Polygon per successful request.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EncodeInput"}}}},"responses":{"200":{"description":"Converted UTF-8 text.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EncodeOutput"}}}},"400":{"description":"Invalid action, text, or encoded input.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Payment required. Follow the x402 v2 challenge before retrying the request.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 v2 payment requirements, including the amount, USDC asset, Polygon network, and receiving wallet.","schema":{"type":"string"}}}},"503":{"description":"The payment facilitator is temporarily unavailable. Retry later; no payment was settled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/clean-csv":{"post":{"operationId":"cleanCsv","x-payment-info":{"protocols":"x402","price":{"mode":"fixed","currency":"USD","amount":"0.01"}},"tags":["csv"],"summary":"Trim, deduplicate, filter, and sort CSV rows","description":"Cleans up to 20,000 data rows while preserving columns and returning row statistics. Costs $0.01 USDC on Polygon per successful request.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CleanCsvInput"}}}},"responses":{"200":{"description":"Cleaned CSV and row statistics.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CleanCsvOutput"}}}},"400":{"description":"Invalid CSV, options, or input size.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Payment required. Follow the x402 v2 challenge before retrying the request.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 v2 payment requirements, including the amount, USDC asset, Polygon network, and receiving wallet.","schema":{"type":"string"}}}},"503":{"description":"The payment facilitator is temporarily unavailable. Retry later; no payment was settled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/batch-hash":{"post":{"operationId":"batchHash","x-payment-info":{"protocols":"x402","price":{"mode":"fixed","currency":"USD","amount":"0.01"}},"tags":["hashing"],"summary":"Hash 2–500 strings in one request","description":"Computes ordered SHA-256 or SHA-512 digests. Costs $0.01 USDC on Polygon per successful batch.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchHashInput"}}}},"responses":{"200":{"description":"Ordered hex digests.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchHashOutput"}}}},"400":{"description":"Invalid algorithm, items, or input size.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"Payment required. Follow the x402 v2 challenge before retrying the request.","headers":{"PAYMENT-REQUIRED":{"description":"Base64-encoded x402 v2 payment requirements, including the amount, USDC asset, Polygon network, and receiving wallet.","schema":{"type":"string"}}}},"503":{"description":"The payment facilitator is temporarily unavailable. Retry later; no payment was settled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"x402":{"type":"apiKey","in":"header","name":"PAYMENT-SIGNATURE","description":"x402 v2 payment authorization for the requested operation."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"HashInput":{"type":"object","properties":{"text":{"type":"string","description":"Single string to hash."},"items":{"type":"array","minItems":1,"maxItems":500,"items":{"type":"string"},"description":"Optional ordered batch of strings. When provided as an array, takes precedence over text."},"algorithm":{"type":"string","enum":["SHA-256","SHA-512","HMAC-SHA-256"],"default":"SHA-256"},"key":{"type":"string","description":"Required only when algorithm is HMAC-SHA-256."}},"anyOf":[{"required":["text"]},{"required":["items"]}]},"HashOutput":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"algorithm":{"type":"string","enum":["SHA-256","SHA-512","HMAC-SHA-256"]},"hash":{"type":"string","description":"Lowercase hexadecimal digest for a single input."},"hashes":{"type":"array","items":{"type":"string"},"description":"Ordered lowercase hexadecimal digests for a batch."},"count":{"type":"integer","minimum":1,"maximum":500}},"required":["ok","algorithm","count"]},"EncodeInput":{"type":"object","properties":{"action":{"type":"string","enum":["base64_encode","base64_decode","base64url_encode","base64url_decode"]},"text":{"type":"string"}},"required":["action","text"]},"EncodeOutput":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"action":{"type":"string","enum":["base64_encode","base64_decode","base64url_encode","base64url_decode"]},"result":{"type":"string"},"inputCharacters":{"type":"integer","minimum":0},"outputCharacters":{"type":"integer","minimum":0}},"required":["ok","action","result","inputCharacters","outputCharacters"]},"CleanCsvInput":{"type":"object","properties":{"csv":{"type":"string","minLength":1,"description":"CSV with a header row."},"options":{"type":"object","properties":{"trim":{"type":"boolean","default":true},"deduplicate":{"type":"boolean","default":true},"removeEmptyRows":{"type":"boolean","default":true},"sortBy":{"type":"string","description":"Optional header name to sort by."},"sortOrder":{"type":"string","enum":["asc","desc"],"default":"asc"}}}},"required":["csv"]},"CleanCsvOutput":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"csv":{"type":"string"},"stats":{"type":"object","properties":{"inputRows":{"type":"integer"},"outputRows":{"type":"integer"},"duplicateRowsRemoved":{"type":"integer"},"emptyRowsRemoved":{"type":"integer"},"columns":{"type":"integer"}},"required":["inputRows","outputRows","duplicateRowsRemoved","emptyRowsRemoved","columns"]}},"required":["ok","csv","stats"]},"BatchHashInput":{"type":"object","properties":{"items":{"type":"array","minItems":2,"maxItems":500,"items":{"type":"string"}},"algorithm":{"type":"string","enum":["SHA-256","SHA-512"],"default":"SHA-256"}},"required":["items"]},"BatchHashOutput":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"algorithm":{"type":"string","enum":["SHA-256","SHA-512"]},"count":{"type":"integer","minimum":2,"maximum":500},"hashes":{"type":"array","minItems":2,"maxItems":500,"items":{"type":"string"}}},"required":["ok","algorithm","count","hashes"]}}}}