{"openapi":"3.0.1","info":{"title":"Result Service API","description":"Contract query service for Conduit UCPI platform","version":"1.0"},"servers":[{"url":"http://resultservice:8975","description":"Generated server url"}],"tags":[{"name":"Results","description":"Contract query endpoints"},{"name":"Health","description":"Service health check"}],"paths":{"/api/results":{"get":{"tags":["Results"],"summary":"Look up contracts from a URL","description":"The same query as the POST form, expressed as query parameters so that it can be a LINK. A receipt names the escrow it describes and has to send a reader somewhere they can check it; a bare endpoint requiring a hand-built JSON body is not somewhere anyone can go. Read-only, so GET is what it should always have been.","operationId":"queryContractsByUrl","parameters":[{"name":"contractid","in":"query","required":false,"schema":{"type":"string"}},{"name":"chainAddress","in":"query","required":false,"schema":{"type":"string"}},{"name":"chainAddresses","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"}}},{"name":"sellerWalletId","in":"query","required":false,"schema":{"type":"string"}},{"name":"disputed","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"resolved","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"defaultArbiter","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"brandId","in":"query","required":false,"schema":{"type":"string"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}}}},"post":{"tags":["Results"],"summary":"Query contracts","description":"Query contracts by contractid, chainAddress, sellerWalletId, disputed and/or resolved. All provided fields use AND logic. At least one must be provided. Every query is public; presenting a valid X-API-Key additionally returns the dispute details.","operationId":"queryContracts","parameters":[{"name":"X-API-Key","in":"header","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"string","description":"Query parameters"}}},"required":true},"responses":{"200":{"description":"Query executed successfully","content":{"*/*":{"schema":{"$ref":"#/components/schemas/QueryResponse"}}}},"400":{"description":"Bad request - No query fields provided"},"503":{"description":"An X-API-Key was presented but this deployment has no admin key configured"},"401":{"description":"An X-API-Key was presented but is not correct. Omit it for the public answer."}}}},"/health":{"get":{"tags":["Health"],"summary":"Health check","description":"Returns 200 OK if the service is running","operationId":"health","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"object","additionalProperties":{"type":"string"}}}}}}}}},"components":{"schemas":{"DisputeDetail":{"required":["reason","refundPercent","timestamp"],"type":"object","properties":{"reason":{"type":"string","description":"The filing party's account of the dispute","example":"The product was not delivered as described"},"refundPercent":{"type":"integer","description":"The refund percentage this party proposes","format":"int32","example":100},"timestamp":{"type":"integer","description":"Unix seconds when the entry was filed","format":"int64","example":1705318200},"userWallet":{"type":"string","description":"Wallet of the filing party; already public on chain","nullable":true,"example":"0x1234567890abcdef1234567890abcdef12345678"}},"description":"A dispute entry, without the filer's email address","nullable":true},"QueryResponse":{"required":["count","results"],"type":"object","properties":{"count":{"type":"integer","description":"Number of results found","format":"int32","example":2},"results":{"type":"array","description":"Array of matching contracts","items":{"$ref":"#/components/schemas/ResultItem"}}},"description":"Query response containing results and count"},"ResultItem":{"required":["amount","createdate","currency","description","disputeCount","maturity","sellerWalletId","state"],"type":"object","properties":{"contractid":{"type":"string","description":"Contract ID","example":"507f1f77bcf86cd799439011"},"chainAddress":{"type":"string","description":"Chain address","example":"0x1234567890abcdef"},"sellerWalletId":{"type":"string","description":"Seller wallet address","example":"0x1234567890abcdef1234567890abcdef12345678"},"amount":{"type":"number","description":"Contract amount","format":"double","example":123.45678},"description":{"type":"string","description":"Contract description","example":"Purchase of 100 units of product X"},"currency":{"type":"string","description":"Currency code","example":"ABCDE"},"state":{"type":"string","description":"Contract state. PRIMARY (user-manageable): OK (default, awaiting buyer), IN-PROCESS (being worked on). TERMINAL (won't change): CLAIMED (funds distributed), NEVER_FUNDED (deployed but unfunded), COMPLETED (successfully finished). BLOCKCHAIN-SYNCED: ACTIVE (on blockchain), DISPUTED (has dispute), RESOLVED (dispute resolved), EXPIRED (time elapsed).","example":"OK","enum":["OK","IN-PROCESS","CLAIMED","NEVER_FUNDED","COMPLETED","ACTIVE","DISPUTED","RESOLVED","EXPIRED"]},"chainId":{"type":"string","description":"Blockchain chain ID","example":"1"},"createdate":{"type":"integer","description":"Creation timestamp","format":"int64","example":1705318200},"maturity":{"type":"integer","description":"Unix seconds at which the contract matures","format":"int64","example":1705318200},"arbiterAddress":{"type":"string","description":"Custom arbiter for this contract; null means the default system arbiter","nullable":true},"brandId":{"type":"string","description":"White-label partner the contract was created under; null for our own brand","nullable":true,"example":"escrow-me"},"disputeCount":{"type":"integer","description":"Number of dispute entries filed through the app","format":"int32","example":0},"lastDisputeAt":{"type":"integer","description":"Unix seconds of the most recent dispute entry, null when there are none","format":"int64","example":1705318200},"disputes":{"type":"array","description":"Dispute entries — reason, refund percentage, timestamp and wallet, never the email. Returned only with a valid X-API-Key; null when the caller did not present one.","nullable":true,"items":{"$ref":"#/components/schemas/DisputeDetail"}}},"description":"Result item from query"}}}}