{"openapi":"3.1.0","info":{"title":"evidencepack API","version":"1.0.0","description":"Headless tool API. Every call is metered and billed in credits. Prices are published at GET /evidence/v1/tools."},"servers":[{"url":"https://api.counselordesk.app"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API key"}}},"paths":{"/evidence/v1/tools/build_evidence_pack":{"post":{"operationId":"evidencepack_build_evidence_pack","summary":"Build a traceable fact packet","description":"Normalizes caller-supplied facts into a versioned packet with source pointers, conflicts, missing required facts, coverage, and a stable digest. It does not fetch or independently verify the sources.","security":[{"bearerAuth":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":128},"description":"Retry-safe key. Guarantees the call is billed at most once."},{"name":"X-Max-Credits","in":"header","required":false,"schema":{"type":"integer","minimum":1,"maximum":2147483647},"description":"Maximum credits approved for this call. Rejects a larger hold and caps the final charge."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["subject","sources"],"properties":{"subject":{"type":"string","minLength":2,"maxLength":200,"description":"The product, program, or topic this packet describes."},"sources":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"object","additionalProperties":false,"required":["id","title","url","retrieved_at","facts"],"properties":{"id":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"},"title":{"type":"string","minLength":1,"maxLength":200},"url":{"type":"string","minLength":10,"maxLength":2000,"pattern":"^https://"},"retrieved_at":{"type":"string","minLength":10,"maxLength":40,"pattern":"^\\d{4}-\\d{2}-\\d{2}"},"facts":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["key","value"],"properties":{"key":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":1000}}}}}}},"required_facts":{"type":"array","maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100},"default":[]}}}}}},"responses":{"200":{"description":"Tool output","content":{"application/json":{"schema":{"type":"object","properties":{"request_id":{"type":"string"},"tool":{"type":"string"},"output":{"type":"object"},"billing":{"type":"object","properties":{"status":{"type":"string","enum":["settled","pending"]},"credits_charged":{"type":["integer","null"]},"credits_remaining":{"type":["integer","null"]}}}}}}}},"402":{"description":"Insufficient credits or approved spending limit exceeded. Inspect error.code."},"429":{"description":"Rate limited. Retry after the Retry-After header."}}}},"/evidence/v1/tools/build_evidence_pack/quote":{"post":{"operationId":"evidencepack_build_evidence_pack_quote","summary":"Quote a Build a traceable fact packet call (free)","description":"Free pre-flight. Validates the input and returns the exact credit hold a real call would take at this account's price, without billing anything. An invalid input is still a 200: the body carries valid:false and the validation errors.","x-billing":"free","security":[{"bearerAuth":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["subject","sources"],"properties":{"subject":{"type":"string","minLength":2,"maxLength":200,"description":"The product, program, or topic this packet describes."},"sources":{"type":"array","minItems":1,"maxItems":20,"items":{"type":"object","additionalProperties":false,"required":["id","title","url","retrieved_at","facts"],"properties":{"id":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[A-Za-z0-9][A-Za-z0-9._:-]*$"},"title":{"type":"string","minLength":1,"maxLength":200},"url":{"type":"string","minLength":10,"maxLength":2000,"pattern":"^https://"},"retrieved_at":{"type":"string","minLength":10,"maxLength":40,"pattern":"^\\d{4}-\\d{2}-\\d{2}"},"facts":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","additionalProperties":false,"required":["key","value"],"properties":{"key":{"type":"string","minLength":1,"maxLength":100},"value":{"type":"string","minLength":1,"maxLength":1000}}}}}}},"required_facts":{"type":"array","maxItems":50,"items":{"type":"string","minLength":1,"maxLength":100},"default":[]}}}}}},"responses":{"200":{"description":"Quote","content":{"application/json":{"schema":{"type":"object","properties":{"tool":{"type":"string"},"valid":{"type":"boolean"},"validation_errors":{"type":"array"},"estimated_credits":{"type":"integer"},"estimated_usd":{"type":"number"},"max_credits_held":{"type":"integer"},"max_credits_per_call":{"type":["integer","null"]},"max_credits_supported":{"type":"boolean"},"credit_balance":{"type":"integer"},"sufficient":{"type":"boolean"},"price_multiplier":{"type":"number"}}}}}}}}}}}