# OpenTDB Trivia via x402

> OpenTDB Trivia via x402 is a paid API for AI agents from x402-v2-mint-opentdb-trivia.vercel.app, paid per call via x402, $0.02018/call, status unknown (last checked 2026-12-03).

Fetches trivia questions from the Open Trivia Database (OpenTDB) with configurable category, difficulty, type, and encoding, billed per call via x402.

## Facts

- Endpoint: POST https://x402-v2-mint-opentdb-trivia.vercel.app/v1/opentdb-trivia?utm_source=zero.xyz
- Price: $0.02018/call
- Payment: x402
- Status: unknown
- Last checked: 2026-12-03
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/opentdb-trivia-via-x402-d53456bb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__EHaa14kFnyxb-K6oeWk2

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 opentdb-trivia-via-x402-d53456bb -d '<json body>'
```

Example prompt: Can you fetch me 10 multiple choice trivia questions on medium difficulty from the Science & Nature category — base64 encoded?

## When to prefer this

Use this endpoint when you need on-demand trivia questions from the well-known OpenTDB database and are operating in an x402 micropayment-enabled environment. Prefer it over direct OpenTDB calls when you need metered, per-call billing integration or when building agents that manage costs via USDC micropayments. Best suited for quiz apps, game bots, educational tools, and entertainment agents needing structured trivia data.

## Known failure modes

- Invalid category ID returns an error or empty results
- Amount outside 1–50 range is rejected by schema validation
- Invalid difficulty or type enum value causes a 400-level error
- Payment failure via x402 results in a 402 response before questions are returned
- Network timeout to upstream OpenTDB API causes a 5xx error
- Unsupported encode value returns a validation error

## How this service works

Open Trivia DB quiz questions (keyless). POST {amount?, category?, difficulty?, type?, encode?}. Unpaid empty → 402; after settle empty/invalid → 400 charged:false. Soft disclose dnd5e-spell (games lane).

## Output

Returns a JSON object with ok:true, the skill name 'opentdb-trivia', a charged:true flag indicating the x402 payment was processed, and a summary field. The actual trivia questions are expected in the response payload per OpenTDB's standard format (question text, correct answer, incorrect answers, category, difficulty, type).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "type": {
   "enum": [
    "multiple",
    "boolean"
   ],
   "type": "string"
  },
  "amount": {
   "type": "integer",
   "maximum": 50,
   "minimum": 1
  },
  "encode": {
   "enum": [
    "url3986",
    "base64",
    ""
   ],
   "type": "string"
  },
  "category": {
   "type": [
    "integer",
    "string"
   ]
  },
  "difficulty": {
   "enum": [
    "easy",
    "medium",
    "hard"
   ],
   "type": "string"
  },
  "request_id": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "skill": "opentdb-trivia",
  "charged": true,
  "summary": "ok"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/opentdb-trivia-via-x402-d53456bb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-v2-mint-opentdb-trivia.vercel.app](https://www.zero.xyz/host/x402-v2-mint-opentdb-trivia.vercel.app/llms.txt)
