{"openapi":"3.1.0","info":{"title":"Agreements.co.in Partner API","version":"1.0.0","description":"B2B API for the legal ecosystem — lawyers, legal-tech platforms, property managers, brokers, and institutions. Create agreement and legal-notice drafts, read status, and run compliance calculations. We provide the rails; you keep your client relationship. Paid execution (payment, eStamp, eSign) is completed by the end customer on agreements.co.in.","contact":{"email":"support@agreements.co.in"}},"servers":[{"url":"https://api.agreements.co.in/api/v1","description":"Production"},{"url":"https://agreements.co.in/api/v1","description":"Production (main host alias)"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"API key issued by Agreements.co.in, e.g. `Authorization: Bearer ak_live_...`"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"}},"required":["code","message","requestId"]}}},"Agreement":{"type":"object","properties":{"reference":{"type":"string","description":"Globally unique reference — the canonical identifier"},"type":{"type":"string"},"status":{"type":"string"},"paymentStatus":{"type":"string"},"pdfUrl":{"type":["string","null"]},"previewUrl":{"type":"string"},"createdAt":{"type":["string","null"],"format":"date-time"}}},"DocumentType":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":["string","null"]},"customerType":{"type":"string","enum":["b2b","b2c","both"]},"documentClass":{"type":"string"},"category":{"type":"string"},"priceRangeInr":{"type":"object","properties":{"min":{"type":"number"},"max":{"type":"number"}}},"aliases":{"type":"array","items":{"type":"string"}},"related":{"type":"array","items":{"type":"string"}},"creatableViaApi":{"type":"boolean"}}}}},"paths":{"/openapi.json":{"get":{"summary":"This document","security":[],"responses":{"200":{"description":"OpenAPI 3.1 document"}}}},"/docs":{"get":{"summary":"Interactive API documentation (Swagger UI)","security":[],"responses":{"200":{"description":"Swagger UI HTML page"}}}},"/document-types":{"get":{"summary":"List live document types (machine-readable catalog)","responses":{"200":{"description":"Catalog of live document types","content":{"application/json":{"schema":{"type":"object","properties":{"documentTypes":{"type":"array","items":{"$ref":"#/components/schemas/DocumentType"}}}}}}},"401":{"description":"Missing/invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agreements":{"post":{"summary":"Create a draft agreement or legal notice","description":"Creates a DRAFT. The end customer completes payment/execution on agreements.co.in via previewUrl. Supports the Idempotency-Key header: replaying a key returns the original agreement instead of creating a duplicate.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","maxLength":128}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","data"],"properties":{"type":{"type":"string","description":"Document type slug from GET /document-types"},"data":{"type":"object","description":"Type-specific agreement fields"}}}}}},"responses":{"200":{"description":"Idempotent replay of an earlier create"},"201":{"description":"Draft created","content":{"application/json":{"schema":{"type":"object","properties":{"agreement":{"$ref":"#/components/schemas/Agreement"},"idempotentReplay":{"type":"boolean"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Unsupported document type","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/agreements/{reference}":{"get":{"summary":"Get an agreement's status by reference (owner-scoped)","parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Agreement status","content":{"application/json":{"schema":{"type":"object","properties":{"agreement":{"$ref":"#/components/schemas/Agreement"}}}}}},"404":{"description":"Not found on this API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calculations/stamp-duty":{"post":{"summary":"Calculate stamp duty and government charges for a rental agreement","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["state","monthlyRent","securityDeposit","durationMonths"],"properties":{"state":{"type":"string","example":"Tamil Nadu"},"monthlyRent":{"type":"number"},"securityDeposit":{"type":"number"},"durationMonths":{"type":"number","example":11}}}}}},"responses":{"200":{"description":"Calculation result with line-item breakdown"},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}