{"openapi":"3.0.3","info":{"title":"TalentTrust API","version":"1.0.0","description":"Milestone-based escrow API for freelancers and clients. State mirrors the TalentTrust Soroban escrow contract on Stellar testnet (CCZMIVUBMG5SBC47SDTC32RWLBJ2HW2DCFVWJEOKCH2IFJBZGBKTXK5W). Explorer: https://stellar.expert/explorer/testnet/contract/CCZMIVUBMG5SBC47SDTC32RWLBJ2HW2DCFVWJEOKCH2IFJBZGBKTXK5W. Data is held in memory and resets on redeploy."},"servers":[{"url":"/"}],"tags":[{"name":"System"},{"name":"Contracts"},{"name":"Reputation"}],"paths":{"/health":{"get":{"tags":["System"],"summary":"Health check","responses":{"200":{"description":"Service is healthy","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/chain":{"get":{"tags":["System"],"summary":"On-chain escrow contract deployment info","responses":{"200":{"description":"Deployment","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/stats":{"get":{"tags":["System"],"summary":"Aggregate escrow statistics","responses":{"200":{"description":"Stats","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/contracts":{"get":{"tags":["Contracts"],"summary":"List escrow contracts","parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"party","in":"query","schema":{"type":"string"},"description":"Client or freelancer address"}],"responses":{"200":{"description":"Contracts","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/EscrowContract"}}}}}}}}},"post":{"tags":["Contracts"],"summary":"Create an escrow contract","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["client","freelancer","milestones"],"properties":{"title":{"type":"string"},"client":{"type":"string"},"freelancer":{"type":"string"},"token":{"type":"string","default":"XLM"},"milestones":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"amount":{"type":"number"}}}}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscrowContract"}}}}}}},"/api/v1/contracts/{id}":{"get":{"tags":["Contracts"],"summary":"Get a contract","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscrowContract"}}}}}}},"/api/v1/contracts/{id}/deposit":{"post":{"tags":["Contracts"],"summary":"Deposit funds into escrow","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"number"}}}}}},"responses":{"200":{"description":"Updated contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscrowContract"}}}}}}},"/api/v1/contracts/{id}/milestones/{index}/release":{"post":{"tags":["Contracts"],"summary":"Release a milestone payment to the freelancer","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"index","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Updated contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscrowContract"}}}}}}},"/api/v1/contracts/{id}/dispute":{"post":{"tags":["Contracts"],"summary":"Open a dispute","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"raisedBy":{"type":"string"},"reason":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscrowContract"}}}}}}},"/api/v1/contracts/{id}/resolve":{"post":{"tags":["Contracts"],"summary":"Resolve a dispute (admin)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"freelancerBps":{"type":"integer"}}}}}},"responses":{"200":{"description":"Updated contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscrowContract"}}}}}}},"/api/v1/contracts/{id}/cancel":{"post":{"tags":["Contracts"],"summary":"Cancel and refund","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Updated contract","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscrowContract"}}}}}}},"/api/v1/contracts/{id}/reputation":{"post":{"tags":["Reputation"],"summary":"Rate the freelancer of a completed contract","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"rating":{"type":"integer","minimum":1,"maximum":5}}}}}},"responses":{"200":{"description":"Reputation","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/reputation/{address}":{"get":{"tags":["Reputation"],"summary":"Get freelancer reputation","parameters":[{"name":"address","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Reputation","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"components":{"schemas":{"EscrowContract":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"client":{"type":"string"},"freelancer":{"type":"string"},"token":{"type":"string"},"milestones":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"title":{"type":"string"},"amount":{"type":"number"},"released":{"type":"boolean"}}}},"totalAmount":{"type":"number"},"fundedAmount":{"type":"number"},"releasedAmount":{"type":"number"},"status":{"type":"string","enum":["Created","Funded","Completed","Disputed","Resolved","Cancelled"]}}}}}}