# WritersLogic Union Branch Classifier

> WritersLogic Union Branch Classifier is a paid API for AI agents from agents.writerslogic.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-11-19).

Evaluates a JSON value against every branch of a oneOf or anyOf schema and reports which branches match, fail (with exact JSON-pointer errors), the closest branch, and discriminator resolution.

## Facts

- Endpoint: POST https://agents.writerslogic.com/api/v1/union-branch?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/writerslogic-union-branch-classifier-e9a0b441
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_qQ8juccbIyIwwBe0WnpCX

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 writerslogic-union-branch-classifier-e9a0b441 -d '<json body>'
```

Example prompt: My API keeps rejecting this payload with 'matches none of the oneOf branches' — can you evaluate this JSON value against the oneOf in my schema (at JSON pointer '/properties/pet') and tell me which branches match, which fail and why, and what the closest branch is?

## When to prefer this

Use this endpoint when an AI agent or developer needs to debug why a JSON payload is rejected by a oneOf or anyOf schema — especially when the error message is vague ('matches none' or 'matches more than one'). It is superior to generic JSON Schema validators because it evaluates every branch independently and surfaces branch-level errors with JSON pointers, identifies the closest branch, and resolves OpenAPI discriminators. Prefer it over manual inspection when schemas have three or more branches or when discriminator logic is involved.

## Known failure modes

- Schema contains remote $ref URLs — only local $refs are supported, remote references are reported as unsupported
- Regex pattern in schema risks catastrophic backtracking — reported as unsupported, branch treated as non-match
- Unknown JSON Schema keywords present — reported as unsupported rather than ignored
- Subschema at the specified JSON pointer does not contain oneOf or anyOf — returns an error
- Both oneOf and anyOf present in subschema but keyword parameter not supplied — ambiguity error returned
- Malformed JSON pointer in 'at' field — returns pointer parse error
- Value or schema fields missing or invalid JSON — returns 400-level error

## How this service works

Pay-per-call agents settled in USDC on Base via x402. Every response carries a signed provenance envelope.

## Output

A structured report listing: which oneOf/anyOf branches the value matches (by index or name), the validation errors (with JSON pointers to offending values) for each non-matching branch, the index of the closest branch (fewest or least severe errors), and if an OpenAPI discriminator is present, which branch it resolves to. Unsupported patterns (catastrophic-backtracking regex, unknown keywords) are flagged rather than silently treated as non-matches.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "at": {
   "type": "string",
   "maxLength": 500,
   "description": "JSON pointer to the subschema holding the union (\"\" for the root, \"/properties/pet\" for a nested one)."
  },
  "value": {
   "description": "The JSON value to classify."
  },
  "schema": {
   "description": "The root schema; $ref targets are resolved inside it. Full JSON Schema 2020-12 (local $ref only)."
  },
  "keyword": {
   "enum": [
    "oneOf",
    "anyOf"
   ],
   "type": "string",
   "description": "Required only when the subschema has both."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/writerslogic-union-branch-classifier-e9a0b441/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agents.writerslogic.com](https://www.zero.xyz/host/agents.writerslogic.com/llms.txt)
