{"openapi":"3.1.0","info":{"title":"Agent JSON Repair and Validation API","version":"1.0.0","description":"Repair malformed JSON, extract one JSON value from surrounding text, validate against JSON Schema, and create deterministic compact JSON hashes. Inputs are bounded, payloads are not stored, supplied code is never executed, and remote schema references are disabled."},"paths":{"/marketplace/rapid/json/v1/repair":{"post":{"tags":["JSON Repair"],"summary":"Repair malformed JSON","description":"Repair common malformed JSON from agents, APIs, logs, and user input. No code is executed and no payload is stored.","operationId":"repairAgentJson","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONRepairRequest"},"examples":{"example":{"summary":"Repair malformed JSON","value":{"text":"```json\n{'customer':'Ada','items':[1,2,],}\n```","expected_top_level":"OBJECT"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONRepairResponse"},"example":{"status":"COMPLETED","repaired":true,"value":{"customer":"Ada","items":[1,2]},"canonical_json":"{\"customer\":\"Ada\",\"items\":[1,2]}","top_level_type":"object","source_sha256":"0000000000000000000000000000000000000000000000000000000000000000","result_sha256":"1111111111111111111111111111111111111111111111111111111111111111","warnings":["The input was structurally repaired. Review the result before using it for a consequential action."],"next_action":"Compare the repaired value with the intended structure before continuing."}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/marketplace/rapid/json/v1/validate":{"post":{"tags":["JSON Schema Validation"],"summary":"Validate JSON against a schema","description":"Validate against Draft 2020-12, 2019-09, 7, 6, or 4. Remote and file references are disabled.","operationId":"validateJsonSchema","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONValidateRequest"},"examples":{"example":{"summary":"Validate JSON against a schema","value":{"instance":{"customer":"Ada","quantity":2},"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","required":["customer","quantity"],"properties":{"customer":{"type":"string"},"quantity":{"type":"integer","minimum":1}},"additionalProperties":false}}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONValidateResponse"},"example":{"status":"COMPLETED","valid":true,"draft":"2020-12","errors_returned":0,"errors_truncated":false,"errors":[],"next_action":"The instance satisfies the supplied schema."}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/marketplace/rapid/json/v1/extract":{"post":{"tags":["JSON Extraction"],"summary":"Extract JSON from text","description":"Extract one strict JSON object or array from prose or code fences, with an explicit bounded repair fallback.","operationId":"extractAgentJson","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONExtractRequest"},"examples":{"example":{"summary":"Extract JSON from text","value":{"text":"The tool result is:\n```json\n{\"status\":\"ok\",\"count\":2}\n```","selection":"ONLY","allow_repair_fallback":true,"expected_top_level":"OBJECT"}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONExtractResponse"},"example":{"status":"COMPLETED","candidate_count":1,"selection":"ONLY","repaired":false,"value":{"status":"ok","count":2},"canonical_json":"{\"count\":2,\"status\":\"ok\"}","top_level_type":"object","source_span":{"start":28,"end":53},"result_sha256":"2222222222222222222222222222222222222222222222222222222222222222","warnings":[],"next_action":"Use the extracted value."}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/marketplace/rapid/json/v1/canonicalize":{"post":{"tags":["JSON Canonicalization"],"summary":"Canonicalize and hash JSON","description":"Create sorted-key compact UTF-8 JSON and its SHA-256 digest. This is a documented stable encoding, not an RFC 8785 claim.","operationId":"canonicalizeJson","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONCanonicalizeRequest"},"examples":{"example":{"summary":"Canonicalize and hash JSON","value":{"value":{"z":1,"a":[true,null,"cafe"]}}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JSONCanonicalizeResponse"},"example":{"status":"COMPLETED","canonical_json":"{\"a\":[true,null,\"cafe\"],\"z\":1}","sha256":"3333333333333333333333333333333333333333333333333333333333333333","byte_length":32,"top_level_type":"object","algorithm":"UTF8_SORTED_KEYS_COMPACT_V1","next_action":"Use the canonical string or SHA-256 digest for deterministic comparison and idempotency."}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"JSONCanonicalizeRequest":{"properties":{"value":{"anyOf":[{"type":"object"},{"type":"array"},{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}],"title":"Value"}},"additionalProperties":false,"type":"object","required":["value"],"title":"JSONCanonicalizeRequest"},"JSONCanonicalizeResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"canonical_json":{"type":"string","title":"Canonical Json"},"sha256":{"type":"string","title":"Sha256"},"byte_length":{"type":"integer","title":"Byte Length"},"top_level_type":{"type":"string","title":"Top Level Type"},"algorithm":{"type":"string","const":"UTF8_SORTED_KEYS_COMPACT_V1","title":"Algorithm","default":"UTF8_SORTED_KEYS_COMPACT_V1"},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["canonical_json","sha256","byte_length","top_level_type","next_action"],"title":"JSONCanonicalizeResponse"},"JSONExtractRequest":{"properties":{"text":{"type":"string","maxLength":262144,"minLength":1,"title":"Text"},"selection":{"type":"string","enum":["ONLY","FIRST"],"title":"Selection","default":"ONLY"},"allow_repair_fallback":{"type":"boolean","title":"Allow Repair Fallback","default":true},"expected_top_level":{"type":"string","enum":["ANY","OBJECT","ARRAY"],"title":"Expected Top Level","default":"ANY"}},"additionalProperties":false,"type":"object","required":["text"],"title":"JSONExtractRequest"},"JSONExtractResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"candidate_count":{"type":"integer","title":"Candidate Count"},"selection":{"type":"string","enum":["ONLY","FIRST"],"title":"Selection"},"repaired":{"type":"boolean","title":"Repaired"},"value":{"anyOf":[{"type":"object"},{"type":"array"},{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}],"title":"Value"},"canonical_json":{"type":"string","title":"Canonical Json"},"top_level_type":{"type":"string","title":"Top Level Type"},"source_span":{"anyOf":[{"$ref":"#/components/schemas/SourceSpan"},{"type":"null"}]},"result_sha256":{"type":"string","title":"Result Sha256"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["candidate_count","selection","repaired","value","canonical_json","top_level_type","source_span","result_sha256","warnings","next_action"],"title":"JSONExtractResponse"},"JSONRepairRequest":{"properties":{"text":{"type":"string","maxLength":262144,"minLength":1,"title":"Text"},"expected_top_level":{"type":"string","enum":["ANY","OBJECT","ARRAY"],"title":"Expected Top Level","default":"ANY"}},"additionalProperties":false,"type":"object","required":["text"],"title":"JSONRepairRequest"},"JSONRepairResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"repaired":{"type":"boolean","title":"Repaired"},"value":{"anyOf":[{"type":"object"},{"type":"array"},{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}],"title":"Value"},"canonical_json":{"type":"string","title":"Canonical Json"},"top_level_type":{"type":"string","title":"Top Level Type"},"source_sha256":{"type":"string","title":"Source Sha256"},"result_sha256":{"type":"string","title":"Result Sha256"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["repaired","value","canonical_json","top_level_type","source_sha256","result_sha256","warnings","next_action"],"title":"JSONRepairResponse"},"JSONValidateRequest":{"properties":{"instance":{"anyOf":[{"type":"object"},{"type":"array"},{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}],"title":"Instance"},"schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"boolean"}],"title":"Schema"},"draft":{"type":"string","enum":["AUTO","2020-12","2019-09","DRAFT7","DRAFT6","DRAFT4"],"title":"Draft","default":"AUTO"},"check_formats":{"type":"boolean","title":"Check Formats","default":false},"max_errors":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Max Errors","default":25}},"additionalProperties":false,"type":"object","required":["instance","schema"],"title":"JSONValidateRequest"},"JSONValidateResponse":{"properties":{"status":{"type":"string","const":"COMPLETED","title":"Status","default":"COMPLETED"},"valid":{"type":"boolean","title":"Valid"},"draft":{"type":"string","title":"Draft"},"errors_returned":{"type":"integer","title":"Errors Returned"},"errors_truncated":{"type":"boolean","title":"Errors Truncated"},"errors":{"items":{"$ref":"#/components/schemas/JSONValidationError"},"type":"array","title":"Errors"},"next_action":{"type":"string","title":"Next Action"}},"additionalProperties":false,"type":"object","required":["valid","draft","errors_returned","errors_truncated","errors","next_action"],"title":"JSONValidateResponse"},"JSONValidationError":{"properties":{"instance_pointer":{"type":"string","title":"Instance Pointer"},"schema_pointer":{"type":"string","title":"Schema Pointer"},"keyword":{"type":"string","title":"Keyword"},"message":{"type":"string","title":"Message"}},"additionalProperties":false,"type":"object","required":["instance_pointer","schema_pointer","keyword","message"],"title":"JSONValidationError"},"SourceSpan":{"properties":{"start":{"type":"integer","title":"Start"},"end":{"type":"integer","title":"End"}},"additionalProperties":false,"type":"object","required":["start","end"],"title":"SourceSpan"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}},"tags":[{"name":"JSON Repair","description":"A bounded, stateless JSON utility designed for API integrations and AI agents."},{"name":"JSON Schema Validation","description":"A bounded, stateless JSON utility designed for API integrations and AI agents."},{"name":"JSON Extraction","description":"A bounded, stateless JSON utility designed for API integrations and AI agents."},{"name":"JSON Canonicalization","description":"A bounded, stateless JSON utility designed for API integrations and AI agents."}],"servers":[{"url":"https://api-production-9502.up.railway.app"}]}