{"uid":"cap_-s3QvyfTVrSKmhttH9Kyt","slug":"foundry-csv-join-cardinality-pre-check-2429983c","name":"Foundry CSV Join Cardinality Pre-Check","description":"Pay-per-request evidence and data tools: CSV validation and reconciliation, DNS/email configuration evidence, and bounded official weather, earthquake, vehicle, company and study records. Exact USDC prices, explicit JSON contracts and source provenance. No mailbox, ownership, medical or safety guarantees.","url":"https://foundry-par007-machine-revenue-mainnet.inference-chip-index.workers.dev/v2/data/csv-join-cardinality-precheck","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"left_csv":{"type":"string","maxLength":12000,"minLength":1},"left_key":{"type":"string","maxLength":100,"minLength":1},"join_type":{"enum":["inner","left","full"],"type":"string"},"right_csv":{"type":"string","maxLength":12000,"minLength":1},"right_key":{"type":"string","maxLength":100,"minLength":1},"maximum_output_rows":{"type":"integer","maximum":250000,"minimum":0}}},"responseSchema":{"type":"json","example":{"route":"csv-join-cardinality-precheck","result":{"status":"WITHIN_LIMIT","left_rows":3,"right_rows":3,"left_sha256":"0000000000000000000000000000000000000000000000000000000000000000","limitations":["Synthetic example hashes."],"right_sha256":"0000000000000000000000000000000000000000000000000000000000000000","matched_pairs":4,"many_to_many_keys":1,"unmatched_left_rows":1,"unmatched_right_rows":1,"maximum_pairs_per_key":4,"predicted_output_rows":5},"observed_at":"2026-09-06T00:00:00Z"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.005","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_GwsS5xKEH8u_5OBMV_eYy","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.005","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Analyzes two CSV datasets before joining them to predict output row counts, detect many-to-many key relationships, and flag cardinality risks without executing the full join.","exampleAgentPrompt":"Before I merge these two CSVs on the 'order_id' column using a left join, can you run a cardinality pre-check to predict how many output rows I'd get and whether there are any many-to-many key explosions? Cap it at 50,000 rows. Here's the left CSV: [left_csv data] and the right CSV: [right_csv data].","exampleUseCases":[{"title":"Safe ETL join size validation","prompt":"I have two CSV files I need to join on 'customer_id' with a full join — can you run a cardinality check first to tell me how many rows the result would have and whether any keys match multiple rows on both sides? Maximum output I can handle is 100,000 rows. Left CSV: [data], Right CSV: [data]."},{"title":"Reconciliation mismatch detection","prompt":"I'm trying to reconcile two CSV exports from our billing system joined on 'invoice_number' using an inner join — before I actually do the merge, can you check how many invoices are unmatched on each side and whether any invoice numbers appear more than once?"},{"title":"Data pipeline fan-out risk check","prompt":"We're about to run a data pipeline that joins a product catalog CSV to a sales CSV on 'sku_code' as a left join, but last time it blew up to millions of rows. Can you pre-check the cardinality and tell me the maximum pairs per key and predicted row count so we know if it's safe? Limit to 250,000 rows."}],"resultDescription":"Returns a JSON object with join status (WITHIN_LIMIT or exceeded), predicted output row count, matched key pair count, many-to-many key count, maximum pairs per a single key, counts of unmatched rows on each side, and SHA-256 fingerprints of both input CSVs for provenance verification. All results are observed at a timestamped moment.","failureModes":["CSV exceeds maxLength of 12,000 characters — request rejected with input validation error","Key column name not found in one or both CSVs — returns error indicating missing column","Invalid join_type value not in enum [inner, left, full] — schema validation failure","Malformed CSV content (unparseable) — parse error returned","maximum_output_rows set to 0 or out of range — validation error","Payment not received (402) — request blocked until USDC payment confirmed"],"whenToPreferThis":"Use this endpoint when you need to safely preview the output size and key cardinality of a CSV join before committing to the actual merge — especially when fan-out from many-to-many keys or unmatched rows could cause downstream processing failures or memory exhaustion. Prefer this over just running the join blindly when working with large or untrusted CSVs, or when you need SHA-256 provenance hashes on both inputs for audit trails.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:51:29.221Z","isFirstParty":false}