{"openapi":"3.1.0","info":{"title":"fundsuite-hub.lovable.app Partner API","version":"1.0.0"},"servers":[{"url":"https://fundsuite-hub.lovable.app/api/public"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"fsk_…"}},"schemas":{"DocumentCategory":{"type":"string","enum":["bank_statement","profit_and_loss","balance_sheet","tax_return","licensing_offer","licensing_agreement","application","other"]},"Scope":{"type":"string","enum":["deals:read","deals:write","documents:write","clients:write"]}}},"paths":{"/v1/deals":{"post":{"summary":"Create a deal","description":"Creates a deal with its client business, optional prefilled application answers (application.business, application.owner1 — never SSNs; the client enters those securely) and optional client users. Give each client your own user id as external_ref: the same person pushed again, on any deal, is recognised and linked instead of duplicated. Choose how clients get in: invite_clients emails a branded sign-in link, return_setup_links returns a one-time setup_url you can send yourself. Sending the same deal external_ref again returns the existing deal (200). Requires scope deals:write.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}},"get":{"summary":"List deals","description":"Newest first. Query: limit (1–100), cursor (next_cursor from the previous page), external_ref, status (stage key), updated_since (ISO 8601). Requires scope deals:read.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}}},"/v1/deals/{id}":{"get":{"summary":"Get a deal","description":"Current stage, amounts, document checklist and counts. Requires scope deals:read.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}}},"/v1/deals/{id}/clients":{"post":{"summary":"Add a client user","description":"Creates the person's portal account when new and gives them access to this deal. can_sign controls signing authority. invite: true emails a branded sign-in link. Requires scope clients:write.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}},"get":{"summary":"List client users","description":"People with access to the deal and whether they can sign. Requires scope deals:read.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}}},"/v1/deals/{id}/clients/{user_id}/setup-link":{"post":{"summary":"Get a new setup link","description":"Issues a fresh one-time link that signs the client in and opens their deal with everything you pushed. Links work once and expire after about an hour, so make one right before you send it. For safety, links are only issued for client-only accounts whose deals are all yours; anyone else (for example a person who already uses another portal) gets 409 existing_account — use invite instead, which emails their own inbox. Requires scope clients:write.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}}},"/v1/deals/{id}/documents":{"post":{"summary":"Upload documents","description":"multipart/form-data with category, one or more file fields (up to 20, 50 MB each) and optional period_start / period_end (YYYY-MM-DD) for statements. An identical file already on the deal returns its id with duplicate: true. Requires scope documents:write.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}},"get":{"summary":"List documents","description":"Files on the deal with category, period, checksum and review status (pending, accepted, rejected). Requires scope deals:read.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}}},"/v1/reference":{"get":{"summary":"Reference lists","description":"Document categories, stage keys with labels, and key scopes. No key needed.","security":[],"responses":{"200":{"description":"OK"},"201":{"description":"Created"}}}}}}