{"openapi":"3.1.0","info":{"title":"twoHelixes API","version":"1","description":"Ask questions, stream reasoning, generate SQL and export charts."},"servers":[{"url":"https://twohelixes.com"}],"paths":{"/v1/query":{"post":{"summary":"Ask about product analytics","description":"Pass analytics_site_id instead of a warehouse source. The site is owner/team checked, event properties become columns, and the result is the same editable chart response as every other query.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}},"/v1/query/stream":{"post":{"summary":"Stream the run","description":"The same call as server-sent events, so a long run can show its progress and its partial chart as it goes. Event names: stage, thought, warning, partial, result, done.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}},"/v1/analytics/funnel":{"get":{"summary":"Measure an ordered event flow","description":"Counts sessions and users that reach two to twelve event steps in event-time order. Sampled streams include observed and weighted session counts rather than hiding the distinction.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/sql/generate":{"post":{"summary":"Generate SQL","description":"Schema-aware SQL for a question. The statement is checked read-only before it is returned, and again before any driver executes it.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}},"/v1/chart/{id}/export":{"get":{"summary":"Export a chart","description":"SVG, PNG or CSV. SVG is drawn by our own exporter - deterministic, no headless browser, and editable markup.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/v1/agent":{"post":{"summary":"Run a deep-research agent","description":"Starts a long-running agent and returns a job id immediately - no SSE connection to hold open. Billed as a base fee plus credits per minute while it runs; a run that produces nothing is refunded in full. Poll /v1/jobs/{id} for progress, findings and an itemised bill.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}}}},"/v1/usage":{"get":{"summary":"See what is running and what it costs","description":"Every meter: what is open right now, the rate it is burning, the minutes already billed and how many minutes your balance covers. The per-minute charges in the ledger can all be traced back to a row here.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/chart/{id}/notebook":{"get":{"summary":"Export a notebook","description":"The whole run as a notebook: the data, the transformation that was run and the chart rebuilt with the same palette. format=ipynb for Jupyter, or the default marimo file, which we can also host for you.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}}}}