Check caller-declared rules across fields of a JSON record: end after start, conditional required, exactly one of

$0.005 USDC per call · Developer and security · POST /api/v1/cross-field-rules · Id cross-field-rules

Evaluates up to 100 rules you declare over one JSON document and reports, per rule, pass, fail or unknown with the JSON pointer of every violating field and the actual value class (absent, null, empty string, value). Rule kinds: compare (>, >=, <, <=, ==, != on numbers, exact decimals, RFC 3339 dates or date-times, strings), required-if, forbidden-if, exactly-one, at-most-one, at-least-one, all-or-none, sum-equals (exact decimal sum with tolerance). A * path segment applies the rule to every array element (/lines/*/end > /lines/*/start). Presence is explicit (defined, non-null, non-empty) so absent, null and empty are never conflated. A missing operand yields unknown unless you choose fail or skip. For agents validating tool arguments or records beyond what a per-field schema can say. Rules are data, not code: no expressions are evaluated.

What you get

Per-field schemas cannot say end > start or one-of-three. 100 rules per $0.005 call, exact decimals and strict date parsing.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/cross-field-rules. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/cross-field-rules \
  -H 'content-type: application/json' \
  -d '{"data":{"start":"2026-03-01","end":"2026-02-01","kind":"card","card":"4111","iban":null},"rules":[{"id":"end-after-start","kind":"compare","left":"/end","op":">","right":"/start","as":"date"},{"id":"card-needs-number","kind":"required-if","when":{"path":"/kind","op":"equals","value":"card"},"require":["/card"]},{"id":"one-payment-method","kind":"exactly-one","fields":["/card","/iban"]}]}'

Input

FieldTypeRequiredDescription
dataanyyesThe JSON document the rules apply to.
rulesarray<object>; max 100 itemsyes
onMissingstring; one of "unknown", "fail", "skip"noMissing or null compare operand: unknown (default), fail or skip.

Example request body

{
  "data": {
    "start": "2026-03-01",
    "end": "2026-02-01",
    "kind": "card",
    "card": "4111",
    "iban": null
  },
  "rules": [
    {
      "id": "end-after-start",
      "kind": "compare",
      "left": "/end",
      "op": ">",
      "right": "/start",
      "as": "date"
    },
    {
      "id": "card-needs-number",
      "kind": "required-if",
      "when": {
        "path": "/kind",
        "op": "equals",
        "value": "card"
      },
      "require": [
        "/card"
      ]
    },
    {
      "id": "one-payment-method",
      "kind": "exactly-one",
      "fields": [
        "/card",
        "/iban"
      ]
    }
  ]
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
rulesarray<object>no
countsobjectno
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the data-contract-kit package.

Machine-readable