{"uid":"cap_JMvmLl_fGzheWc-6fNzDa","slug":"apiacre-com-data-contract-normalize-infer-schema-validate-d7cdb930","name":"apiacre.com Data Contract — Normalize, Infer Schema & Validate","description":"Normalize caller-supplied CSV, TSV, JSON, JSON Lines, or YAML to deterministic JSON, infer a Draft 2020-12 schema from that normalized value, and validate one future JSON value in a single x402 call.","url":"https://apiacre.com/v1/data/contract","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"format":{"enum":["csv","tsv","json","jsonl","yaml"],"type":"string"},"content":{"type":"string"},"instance":{},"root_mode":{"enum":["records","preserve"],"type":"string"},"max_errors":{"type":"integer"},"check_formats":{"type":"boolean"}}},"responseSchema":{"type":"json","example":{"data":{"contract":{"input":{"format":"json","records":1,"rootMode":"records","utf8Bytes":46,"characters":46},"schema":{"type":"array","items":{"type":"object","required":["name","score"],"properties":{"name":{"type":"string","x-apiacre-observed":{"types":["string"],"nullCount":0,"sampleCount":1,"missingCount":0,"presentCount":1}},"score":{"type":"integer","x-apiacre-observed":{"types":["integer"],"nullCount":0,"sampleCount":1,"missingCount":0,"presentCount":1}}},"x-apiacre-observed":{"types":["object"],"nullCount":0,"sampleCount":1,"missingCount":0,"presentCount":1}},"$schema":"https://json-schema.org/draft/2020-12/schema","x-apiacre-observed":{"types":["array"],"nullCount":0,"sampleCount":1,"missingCount":0,"presentCount":1}},"inference":{"dialect":"https://json-schema.org/draft/2020-12/schema","version":"apiacre-schema-inference/3","csvEmptyStringsAsNull":false,"csvNumericStringsCoerced":false,"tabularNumericStringsCoerced":false}},"pipeline":{"steps":["normalize-to-json","infer-draft-2020-12","validate-instance"],"version":"apiacre-data-contract/1","deterministic":true,"networkRequestsMade":0,"singlePaymentAuthorization":true},"normalized":{"format":"json","content":"[\n  {\n    \"name\": \"Ada\",\n    \"score\": 98\n  }\n]","records":1,"rootMode":"records","sourceFormat":"json"},"validation":{"valid":true,"errorCount":0,"schemaValid":true,"instanceValid":true,"errorCountExact":true}},"meta":{"cached":false,"sources":[],"warnings":[],"duration_ms":42,"next_actions":[]},"service":"data.contract","version":"1","request_id":"018f1f54-7f38-7ba2-8dc3-5f90272d9f1a"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.035","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.035/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.035","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.035","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_i8rUBJ0YJd39pL5D-jIuW","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.035","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Normalizes CSV, TSV, JSON, JSON Lines, or YAML into canonical JSON, infers a JSON Schema Draft 2020-12 from it, and optionally validates a second JSON value against that schema — all in one call.","exampleAgentPrompt":"Take this CSV data and normalize it to clean JSON, infer a Draft 2020-12 JSON schema from it, and then check whether this candidate record — {\"name\":\"Alice\",\"age\":\"thirty\"} — is valid against that schema.","exampleUseCases":[{"title":"Validate incoming API payload against inferred schema","prompt":"I have a YAML config file I use as my data template — normalize it to JSON, infer a schema from it, and then tell me if this new JSON object {\"env\":\"prod\",\"replicas\":3} passes validation against that schema."},{"title":"CSV-to-JSON normalization for a data pipeline","prompt":"Convert this CSV export from our database into deterministic JSON and give me the inferred Draft 2020-12 schema so I can use it as the contract for downstream consumers."},{"title":"Validate a user-submitted JSON record","prompt":"Here's a JSON Lines sample of our event records — normalize it, infer the schema, and check whether this user-submitted event {\"event_type\":\"click\",\"timestamp\":\"not-a-date\",\"user_id\":99} would pass validation."}],"resultDescription":"Returns normalized canonical JSON from the input data, a fully inferred JSON Schema Draft 2020-12 describing the structure of that data, and (if a candidate value was supplied) a structured validation result including any schema violation errors.","failureModes":["Unparseable input format returns a 4xx error indicating the format could not be detected or parsed","Candidate value validation may fail with detailed schema violation messages rather than a hard error","Ambiguous or empty input may result in a minimal or overly permissive inferred schema","Malformed JSON in the candidate validation value returns a parse error","Payment failure via x402 results in request rejection before processing"],"whenToPreferThis":"Choose this endpoint when you need to normalize heterogeneous data formats (CSV, TSV, YAML, JSON Lines) into canonical JSON and simultaneously obtain a machine-readable schema contract in a single atomic call. It is especially valuable when you want to validate a future or incoming record against the schema derived from your sample data in one round-trip, eliminating the need for separate normalization, schema inference, and validation steps.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T12:47:28.014Z","isFirstParty":false}