# Foundry CSV Join Cardinality Pre-Check

> Foundry CSV Join Cardinality Pre-Check is a paid API for AI agents from foundry-par007-machine-revenue-mainnet.inference-chip-index.workers.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

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.

## Facts

- Endpoint: POST https://foundry-par007-machine-revenue-mainnet.inference-chip-index.workers.dev/v2/data/csv-join-cardinality-precheck
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/foundry-csv-join-cardinality-pre-check-2429983c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-s3QvyfTVrSKmhttH9Kyt

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability foundry-csv-join-cardinality-pre-check-2429983c -d '<json body>'
```

Example prompt: 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].

## When to prefer this

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.

## Known failure modes

- 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

## How this service works

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.

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "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"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/foundry-csv-join-cardinality-pre-check-2429983c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from foundry-par007-machine-revenue-mainnet.inference-chip-index.workers.dev](https://www.zero.xyz/host/foundry-par007-machine-revenue-mainnet.inference-chip-index.workers.dev/llms.txt)
