{"openapi":"3.1.0","info":{"title":"Dealgraph API","version":"1.4.0","description":"Programmatic access to Dealgraph VC portfolio data for external agents. Read endpoints cover all portfolio data; write endpoints require a read_write-scoped key. All data is scoped to the API key's organization. All monetary values are absolute EUR (decimal string, e.g. \"12500000.00\"); there is no millions/€M representation at the API boundary. Note: valuations are stored at €10,000 granularity, so a written valuation is rounded to the nearest €10k. Errors use the envelope { error: { code, message, field?, details? } } with a stable `code`. Writes accept ?dryRun=true (or header `Prefer: validate`) to validate + return the would-be result without persisting (response carries `X-Dry-Run: true`), and an optional `X-Actor` header recorded to the audit log. DELETE soft-deletes by default (restorable via POST .../{id}/restore); pass ?hard=true to permanently delete. Rate limit: 120 requests/minute per API key (best effort); every response carries X-RateLimit-Limit / X-RateLimit-Remaining / X-RateLimit-Reset, and 429 responses carry Retry-After (seconds) with error code rate_limited. Pagination: list endpoints intentionally return all organization rows at current scale (/search caps at 50, /changes at 4000, /audit at 1000); use ?updatedSince= or GET /changes for incremental pulls instead of re-listing. Try it without an account: the public read-only demo key `dg_demo` serves a fictional organization (reads fully, writes only as ?dryRun=true simulations). Also available: a hosted MCP server at /api/mcp (streamable HTTP; same bearer keys, demo fallback) and agent-optimized docs at /llms.txt and /llms-full.txt."},"servers":[{"url":"/api/v1","description":"Relative to this deployment"}],"security":[{"bearerAuth":[]}],"paths":{"/portfolios":{"get":{"summary":"List portfolios","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Portfolios in the organization","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"portfolios":{"type":"array","items":{"$ref":"#/components/schemas/Portfolio"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Create a portfolio","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. Repeated POSTs with the same key replay the original response instead of creating a duplicate; a different body for the same key returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortfolioInput"}}}},"responses":{"201":{"description":"Created portfolio","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"portfolio":{"$ref":"#/components/schemas/Portfolio"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/portfolios/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get a portfolio with investments","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Portfolio + investments","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"patch":{"summary":"Update a portfolio","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortfolioInput"}}}},"responses":{"200":{"description":"Updated portfolio","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"portfolio":{"$ref":"#/components/schemas/Portfolio"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Delete a portfolio","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"portfolio":{"$ref":"#/components/schemas/Portfolio"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/portfolios/{id}/stats":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Portfolio KPIs + MOIC","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Stats + MOIC","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/portfolios/{id}/reported-marks":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"List GP-reported NAV/TVPI marks for a fund portfolio","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Reported marks","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"reportedMarks":{"type":"array","items":{"$ref":"#/components/schemas/ReportedMark"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Record a GP-reported fund mark (latest by asOfDate overrides bottom-up valuation)","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. Repeated POSTs with the same key replay the original response instead of creating a duplicate; a different body for the same key returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportedMarkInput"}}}},"responses":{"201":{"description":"Created/updated reported mark","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"reportedMark":{"$ref":"#/components/schemas/ReportedMark"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/reported-marks/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"delete":{"summary":"Delete a GP-reported fund mark","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/portfolios/{id}/drawdowns":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"List drawdown notices for a fund portfolio","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Drawdown notices","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"drawdowns":{"type":"array","items":{"$ref":"#/components/schemas/Drawdown"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Create a drawdown notice","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. Repeated POSTs with the same key replay the original response instead of creating a duplicate; a different body for the same key returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrawdownInput"}}}},"responses":{"201":{"description":"Created drawdown","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"drawdown":{"$ref":"#/components/schemas/Drawdown"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/drawdowns/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"patch":{"summary":"Update a drawdown notice","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DrawdownInput"}}}},"responses":{"200":{"description":"Updated drawdown","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"drawdown":{"$ref":"#/components/schemas/Drawdown"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Delete a drawdown notice","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/companies":{"get":{"summary":"List companies","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."},{"name":"portfolioId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["active","watch","exited","lost"]}},{"name":"sector","in":"query","required":false,"schema":{"type":"string"}},{"name":"geoHqCountry","in":"query","required":false,"schema":{"type":"string"}},{"name":"externalRef","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by cross-system id, e.g. iec:312."},{"name":"updatedSince","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Return only records updated at/after this ISO timestamp."}],"responses":{"200":{"description":"Companies","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"companies":{"type":"array","items":{"$ref":"#/components/schemas/Company"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Create a company","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. Repeated POSTs with the same key replay the original response instead of creating a duplicate; a different body for the same key returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyInput"}}}},"responses":{"201":{"description":"Created company","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"company":{"$ref":"#/components/schemas/Company"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/companies/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"Get a company with investments, performance and per-portfolio positions","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Company + investments + performance + positions[] (one per holding portfolio)","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"company":{"$ref":"#/components/schemas/Company"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"patch":{"summary":"Update a company","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyInput"}}}},"responses":{"200":{"description":"Updated company","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"company":{"$ref":"#/components/schemas/Company"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Delete a company","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/companies/{id}/funding-rounds":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"List funding rounds for a company","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Funding rounds","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"fundingRounds":{"type":"array","items":{"$ref":"#/components/schemas/FundingRound"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Add a funding round (recomputes company valuation)","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. Repeated POSTs with the same key replay the original response instead of creating a duplicate; a different body for the same key returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingRoundInput"}}}},"responses":{"201":{"description":"Created funding round","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"fundingRound":{"$ref":"#/components/schemas/FundingRound"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/funding-rounds/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"patch":{"summary":"Update a funding round","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingRoundInput"}}}},"responses":{"200":{"description":"Updated funding round","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"fundingRound":{"$ref":"#/components/schemas/FundingRound"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Delete a funding round","responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/companies/{id}/metrics":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"get":{"summary":"List metric datapoints (reportings)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."},{"name":"latest","in":"query","required":false,"schema":{"type":"boolean"},"description":"Return latest datapoint per metric key"},{"name":"metricKey","in":"query","required":false,"schema":{"type":"string","enum":["arr_eur","headcount","runway_months","traction_score","moat_score","valuation_eur_m"]}},{"name":"dateFrom","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"dateTo","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"updatedSince","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Return only records updated at/after this ISO timestamp."}],"responses":{"200":{"description":"Metrics","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"metrics":{"type":"array","items":{"$ref":"#/components/schemas/Metric"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Add a metric datapoint (updates company latest caches)","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. Repeated POSTs with the same key replay the original response instead of creating a duplicate; a different body for the same key returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricInput"}}}},"responses":{"201":{"description":"Created metric","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"metric":{"$ref":"#/components/schemas/Metric"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/metrics/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"patch":{"summary":"Update a metric datapoint","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MetricUpdateInput"}}}},"responses":{"200":{"description":"Updated metric","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"metric":{"$ref":"#/components/schemas/Metric"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Delete a metric datapoint","responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/investments":{"get":{"summary":"List investments","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."},{"name":"portfolioId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"companyId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"externalRef","in":"query","required":false,"schema":{"type":"string"},"description":"Filter by cross-system id, e.g. iec:312."},{"name":"updatedSince","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Return only records updated at/after this ISO timestamp."}],"responses":{"200":{"description":"Investments","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"investments":{"type":"array","items":{"$ref":"#/components/schemas/Investment"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Create an investment","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. Repeated POSTs with the same key replay the original response instead of creating a duplicate; a different body for the same key returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvestmentInput"}}}},"responses":{"201":{"description":"Created investment","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"investment":{"$ref":"#/components/schemas/Investment"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/investments/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"patch":{"summary":"Update an investment","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvestmentInput"}}}},"responses":{"200":{"description":"Updated investment","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"investment":{"$ref":"#/components/schemas/Investment"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Delete an investment","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/dashboard":{"get":{"summary":"Org-level KPIs + MOIC","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."},{"name":"portfolioId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Stats + MOIC","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/search":{"get":{"summary":"Search companies, investments, portfolios","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."},{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"default":10}}],"responses":{"200":{"description":"Search results","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/changes":{"get":{"summary":"Change feed (created/updated/deleted) since a timestamp (FR-5)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."},{"name":"since","in":"query","required":true,"schema":{"type":"string","format":"date-time"},"description":"Return entities changed at/after this ISO timestamp."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":4000,"default":500}}],"responses":{"200":{"description":"Change records","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"changes":{"type":"array","items":{"$ref":"#/components/schemas/Change"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/audit":{"get":{"summary":"Audit trail for v1 writes (FR-9)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."},{"name":"entityId","in":"query","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"entityType","in":"query","required":false,"schema":{"type":"string"}},{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"default":200}}],"responses":{"200":{"description":"Audit entries","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"audit":{"type":"array","items":{"$ref":"#/components/schemas/AuditEntry"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/webhooks":{"get":{"summary":"List webhook endpoints (admin) (FR-5)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Webhook endpoints","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"post":{"summary":"Register a webhook endpoint (admin); returns the signing secret","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Optional. Repeated POSTs with the same key replay the original response instead of creating a duplicate; a different body for the same key returns 409."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"}}}},"responses":{"201":{"description":"Created webhook","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/webhooks/{id}":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"patch":{"summary":"Update a webhook endpoint (admin)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookInput"}}}},"responses":{"200":{"description":"Updated webhook","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"webhook":{"$ref":"#/components/schemas/Webhook"}}}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}},"delete":{"summary":"Delete a webhook endpoint (admin)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Deletion result","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/companies/{id}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Restore a soft-deleted company (FR-8)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/investments/{id}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Restore a soft-deleted investment (FR-8)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/portfolios/{id}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Restore a soft-deleted portfolio (FR-8)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/metrics/{id}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Restore a soft-deleted metric datapoint (FR-8)","responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/funding-rounds/{id}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Restore a soft-deleted funding round (FR-8)","responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}},"/drawdowns/{id}/restore":{"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"post":{"summary":"Restore a soft-deleted drawdown notice (FR-8)","parameters":[{"name":"orgId","in":"query","required":false,"schema":{"type":"string"},"description":"Target organization (slug or UUID). Defaults to the API key's organization. Only super-admin keys may target other organizations."}],"responses":{"200":{"description":"Restored","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","additionalProperties":true}}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"},"500":{"$ref":"#/components/responses/Error"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Dealgraph API key, e.g. `dg_live_...`. Read-only keys may call GET only."}},"responses":{"Error":{"description":"Error envelope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","enum":["validation_error","unauthorized","forbidden_readonly","forbidden","not_found","unique_conflict","idempotency_conflict","rate_limited","internal"]},"message":{"type":"string"},"field":{"type":"string","description":"Offending field on validation errors"},"details":{"type":"object","additionalProperties":true}},"required":["code","message"]}}},"PortfolioInput":{"type":"object","properties":{"name":{"type":"string"},"category":{"type":"string","enum":["direct","fund","other"]},"type":{"type":"string","nullable":true},"color":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"vintageYear":{"type":"integer","nullable":true,"description":"fund only"},"fundManager":{"type":"string","nullable":true,"description":"fund only"},"totalFundSizeEur":{"type":"string","nullable":true,"description":"fund only"},"ownershipPct":{"type":"string","nullable":true,"description":"fund only (0-100)"},"committedCapitalEur":{"type":"string","nullable":true,"description":"fund only"}},"required":["name"]},"CompanyInput":{"type":"object","properties":{"name":{"type":"string"},"sector":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"reportingStatus":{"type":"string","nullable":true,"description":"Current qualitative reporting context (e.g. reporting-currency switch, topco change), separate from description"},"geoHqCountry":{"type":"string","nullable":true},"geoHqCity":{"type":"string","nullable":true},"foundedYear":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","watch","exited","lost"]},"externalRef":{"type":"string","nullable":true,"description":"cross-system id, e.g. iec:312"}},"required":["name"]},"FundingRoundInput":{"type":"object","description":"All amounts absolute EUR. CLA/SAFE rounds must omit valuationPostEur; valuationPreEur (the cap) is OPTIONAL (discount/MFN-only converts have no cap). Equity rounds require valuationPostEur. At least one of amountRaisedEur / valuationPreEur / valuationPostEur is required. On PATCH, send valuationPostEur:null to clear it when switching an equity round to cla/safe.","properties":{"roundDate":{"type":"string","format":"date"},"amountRaisedEur":{"type":"string","nullable":true,"description":"absolute EUR"},"stage":{"type":"string","nullable":true,"description":"Pre-Seed, Seed, Series A, ..."},"roundType":{"type":"string","enum":["cla","safe","equity"]},"valuationPreEur":{"type":"string","nullable":true,"description":"pre-money, absolute EUR"},"valuationPostEur":{"type":"string","nullable":true,"description":"post-money, absolute EUR"},"source":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["roundDate"]},"MetricInput":{"type":"object","description":"Reporting datapoint. traction_score/moat_score must be 1-10; arr_eur/headcount/runway_months/valuation_eur_m must be >= 0. valueNumeric is absolute EUR for arr_eur and valuation_eur_m; posting valuation_eur_m updates the company's valuationLatestEur (latest-by-date).","properties":{"metricKey":{"type":"string","enum":["arr_eur","headcount","runway_months","traction_score","moat_score","valuation_eur_m"]},"metricDate":{"type":"string","format":"date"},"valueNumeric":{"type":"string"},"source":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["metricKey","metricDate","valueNumeric"]},"MetricUpdateInput":{"type":"object","properties":{"metricDate":{"type":"string","format":"date"},"valueNumeric":{"type":"string"},"source":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}}},"InvestmentInput":{"type":"object","properties":{"companyId":{"type":"string","format":"uuid"},"portfolioId":{"type":"string","format":"uuid"},"fundingRoundId":{"type":"string","format":"uuid","nullable":true},"conversionFundingRoundId":{"type":"string","format":"uuid","nullable":true},"instrumentType":{"type":"string","enum":["cla","safe","equity","debt","grant","other"],"nullable":true},"vehicle":{"type":"string","nullable":true},"ticketEur":{"type":"string","nullable":true,"description":"absolute EUR"},"entryValuationEur":{"type":"string","nullable":true,"description":"entry valuation/cap, absolute EUR"},"entryStage":{"type":"string","nullable":true},"valuationSource":{"type":"string","nullable":true},"investmentDate":{"type":"string","format":"date","nullable":true},"ownershipPct":{"type":"string","nullable":true},"proRata":{"type":"boolean","nullable":true},"externalRef":{"type":"string","nullable":true,"description":"cross-system id, e.g. iec:312"},"notes":{"type":"string","nullable":true}},"required":["companyId","portfolioId"]},"DrawdownInput":{"type":"object","properties":{"title":{"type":"string","nullable":true},"drawdownDate":{"type":"string","format":"date"},"totalFundAmountEur":{"type":"string","description":"On create: the drawdown total. On PATCH it is DERIVED (investment legs + fees + manualAmountEur) — sending a value that conflicts with the derived total returns validation_error; adjust manualAmountEur to correct the total."},"managementFeesEur":{"type":"string","nullable":true},"organizationalExpensesEur":{"type":"string","nullable":true},"otherExpensesEur":{"type":"string","nullable":true},"manualAmountEur":{"type":"string","nullable":true},"manualAmountComment":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"investments":{"type":"array","items":{"type":"object","properties":{"companyId":{"type":"string","format":"uuid","nullable":true},"investmentId":{"type":"string","format":"uuid","nullable":true},"newInvestmentAmount":{"type":"string","nullable":true},"newInvestmentDate":{"type":"string","format":"date","nullable":true},"amount":{"type":"string","nullable":true}}}}},"required":["drawdownDate","totalFundAmountEur"]},"Company":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"externalRef":{"type":"string","nullable":true},"sector":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"reportingStatus":{"type":"string","nullable":true},"geoHqCountry":{"type":"string","nullable":true},"geoHqCity":{"type":"string","nullable":true},"foundedYear":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","watch","exited","lost"],"nullable":true},"arrEurLatest":{"type":"string","nullable":true,"description":"absolute EUR (cached)"},"headcountLatest":{"type":"integer","nullable":true},"runwayMonthsLatest":{"type":"string","nullable":true},"tractionScoreLatest":{"type":"integer","nullable":true},"moatScoreLatest":{"type":"integer","nullable":true},"valuationLatestEur":{"type":"string","nullable":true,"description":"absolute EUR (cached)"},"valuationLatestDate":{"type":"string","format":"date","nullable":true},"valuationLatestSource":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Portfolio":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"category":{"type":"string","enum":["direct","fund","other"]},"type":{"type":"string","nullable":true},"color":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"vintageYear":{"type":"integer","nullable":true},"fundManager":{"type":"string","nullable":true},"totalFundSizeEur":{"type":"string","nullable":true,"description":"absolute EUR"},"ownershipPct":{"type":"string","nullable":true},"committedCapitalEur":{"type":"string","nullable":true,"description":"absolute EUR"},"paidInCapitalEur":{"type":"string","nullable":true,"description":"absolute EUR (cached)"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"FundingRound":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"roundDate":{"type":"string","format":"date"},"amountRaisedEur":{"type":"string","nullable":true,"description":"absolute EUR"},"stage":{"type":"string","nullable":true},"roundType":{"type":"string","enum":["cla","safe","equity"]},"valuationPreEur":{"type":"string","nullable":true,"description":"absolute EUR"},"valuationPostEur":{"type":"string","nullable":true,"description":"absolute EUR"},"source":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Metric":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"metricKey":{"type":"string","enum":["arr_eur","headcount","runway_months","traction_score","moat_score","valuation_eur_m"]},"metricDate":{"type":"string","format":"date"},"valueNumeric":{"type":"string","description":"absolute EUR for arr_eur/valuation_eur_m; raw value otherwise"},"valueUnit":{"type":"string","nullable":true,"readOnly":true,"description":"Reserved for a future unit annotation (EUR / MONTHS / SCORE_1_10); currently always null. Units are fixed per metricKey: arr_eur and valuation_eur_m are absolute EUR, runway_months is months, scores are 1-10."},"source":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Investment":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"companyId":{"type":"string","format":"uuid"},"portfolioId":{"type":"string","format":"uuid"},"fundingRoundId":{"type":"string","format":"uuid","nullable":true},"conversionFundingRoundId":{"type":"string","format":"uuid","nullable":true},"instrumentType":{"type":"string","enum":["cla","safe","equity","debt","grant","other"],"nullable":true},"vehicle":{"type":"string","nullable":true},"ticketEur":{"type":"string","nullable":true,"description":"absolute EUR"},"entryValuationEur":{"type":"string","nullable":true,"description":"absolute EUR"},"entryStage":{"type":"string","nullable":true},"valuationSource":{"type":"string","nullable":true},"investmentDate":{"type":"string","format":"date","nullable":true},"ownershipPct":{"type":"string","nullable":true},"proRata":{"type":"boolean","nullable":true},"externalRef":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Drawdown":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"portfolioId":{"type":"string","format":"uuid"},"drawdownDate":{"type":"string","format":"date"},"totalFundAmountEur":{"type":"string","description":"absolute EUR"},"managementFeesEur":{"type":"string","nullable":true},"organizationalExpensesEur":{"type":"string","nullable":true},"otherExpensesEur":{"type":"string","nullable":true},"manualAmountEur":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"ReportedMarkInput":{"type":"object","description":"GP-reported mark for a fund portfolio (FR-13). The latest mark (by asOfDate) overrides the bottom-up valuation. reportedNavEur is the LP position's reported NAV in absolute EUR; TVPI/DPI/MOIC are unitless ratios. At least one of reportedNavEur / reportedTvpi / reportedDpi / reportedMoic is required. Re-posting an existing asOfDate updates that mark.","properties":{"asOfDate":{"type":"string","format":"date","description":"GP report effective date"},"reportedNavEur":{"type":"string","nullable":true,"description":"LP NAV, absolute EUR"},"reportedTvpi":{"type":"string","nullable":true,"description":"Total Value / Paid-In"},"reportedDpi":{"type":"string","nullable":true,"description":"Distributions / Paid-In"},"reportedMoic":{"type":"string","nullable":true,"description":"MOIC on invested (ex-fees)"},"source":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["asOfDate"]},"ReportedMark":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"portfolioId":{"type":"string","format":"uuid"},"asOfDate":{"type":"string","format":"date"},"reportedNavEur":{"type":"string","nullable":true,"description":"absolute EUR"},"reportedTvpi":{"type":"string","nullable":true},"reportedDpi":{"type":"string","nullable":true},"reportedMoic":{"type":"string","nullable":true},"source":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"Change":{"type":"object","properties":{"entityType":{"type":"string","description":"company | investment | portfolio | metric | funding_round | drawdown"},"entityId":{"type":"string","format":"uuid"},"action":{"type":"string","enum":["created","updated","deleted"]},"occurredAt":{"type":"string","format":"date-time"}}},"AuditEntry":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"actorType":{"type":"string","description":"api_key | user"},"actorId":{"type":"string","format":"uuid","nullable":true},"actorName":{"type":"string","nullable":true,"description":"API key name or X-Actor override"},"apiKeyId":{"type":"string","format":"uuid","nullable":true},"entityType":{"type":"string"},"entityId":{"type":"string","format":"uuid","nullable":true},"action":{"type":"string","enum":["create","update","delete","restore"]},"createdAt":{"type":"string","format":"date-time"}}},"WebhookInput":{"type":"object","description":"Webhook endpoint. Receives POSTs `{event, entityType, entityId, action, occurredAt, organizationId}` on writes, signed with HMAC-SHA256(body, secret) in the X-DealGraph-Signature header. Delivery is best-effort — use GET /changes for guaranteed reconciliation.","properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"},"nullable":true,"description":"subset of `<entity>.<action>` (e.g. company.create); null/empty = all"},"active":{"type":"boolean"}},"required":["url"]},"Webhook":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"secret":{"type":"string","description":"HMAC signing secret (shown so you can verify signatures)"},"events":{"type":"array","items":{"type":"string"},"nullable":true},"active":{"type":"boolean"},"lastDeliveryAt":{"type":"string","format":"date-time","nullable":true},"lastDeliveryStatus":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}