TogaAI API
The legal API for Portugal.
Integrate Portuguese legal AI into your app by API. A single POST returns answers grounded in real Portuguese legislation and case law — with links — streaming token by token. And the model never sees personal data.
curl https://togai.pt/api/v1/chat \
-H "Authorization: Bearer sk_toga_live_..." \
-H "Content-Type: application/json" \
-d '{"message":"Summarize the termination clauses in this contract","mode":"fast","effort":"medium","stream":false}'{ "answer": "Under article 1097 of the Portuguese Civil Code…", "sources": [ { "citation_number": 1, "url": "https://www.dgsi.pt/…" } ], "usage": { "input_tokens": 4210, "output_tokens": 980 }, "cost_micro": 8540, "mode": "deep"}Streaming
Watch the answer arrive, token by token.
By default the endpoint returns Server-Sent Events: first the sources, then the answer in a continuous stream and, at the end, usage and the exact cost. Ideal for chat UIs — the user sees the answer forming instead of waiting for a block.
- Events
sources,chunkanddone. - Need a single block? stream: false returns JSON.
- The cost (
cost_micro) arrives in the final event.
message "Notice period to oppose the renewal of a residential lease in Portugal?"
mode deep·stream true
Privacy by architecture
The model never sees personal data.
Before it leaves, your request goes through anonymization run on a European model: names, tax numbers, addresses, contacts, IBAN and license plates become pseudonyms. Only the anonymized text reaches the generation model — and the search. The real values are reinserted on our side, in real time, as the answer arrives.
Your request
João Silva, NIF 234…, IBAN…
Anonymization
João Silva → Person A
EU · Frankfurt
Generation model
sees only pseudonyms
Response
real values reinserted
Capabilities
Everything the assistant does in the app — by API.
Real Portuguese sources, with links
Searches the web and returns verifiable case law and legislation. Each source arrives in sources[] with its url.
Mode and effort, per request
fast/deep and low/medium/high on every call. Control depth and cost without switching endpoint.
Anonymization by default
Personal data pseudonymized in the EU before it leaves. If anonymization fails, the request is blocked.
Documents as context
Up to 10 text documents — contracts, drafts, pleadings — to ground the answer in your case.
Streaming SSE or JSON
Server-Sent Events token by token by default. Prefer a single block? stream:false returns JSON.
Cost in plain sight on every response
Each response carries cost_micro (micro-EUR) and usage with input/output tokens. No estimates.
Quickstart
One call. That’s it.
Authenticate with your key, send the message and choose the mode. You get the answer — and the exact request cost in cost_micro.
curl https://togai.pt/api/v1/chat \
-H "Authorization: Bearer sk_toga_live_..." \
-H "Content-Type: application/json" \
-d '{"message":"Summarize the termination clauses in this contract","mode":"fast","effort":"medium","stream":false}'{ "answer": "Under article 1097 of the Portuguese Civil Code…", "sources": [ { "citation_number": 1, "url": "https://www.dgsi.pt/…" } ], "usage": { "input_tokens": 4210, "output_tokens": 980 }, "cost_micro": 8540, "mode": "deep"}Pricing
You pay for what you use — nothing more.
Token-based billing, with each request’s cost in plain sight. No rigid plans, no surprises.
€14 per 1M tokens· input + output · ≈ €0.014 / 1,000 tokens
- You pay only the input + output tokens of each request.
- Each response carries
cost_micro— the exact cost, in micro-EUR. - API wallet separate from the app subscription.
- Prepaid available today; pay-as-you-go soon.
Free credit
€2
welcome credit
Applied automatically to new accounts. Top up whenever you want — the API wallet is separate from the app subscription.
FAQ
The TogaAI legal API, in short.
How to integrate Portuguese legal AI by API — sources, privacy, pricing and supported languages.
What is the TogaAI legal API?
It is a REST API that integrates the TogaAI legal assistant into your application. A POST to https://togai.pt/api/v1/chat returns answers grounded in real Portuguese legislation and case law, with verifiable links, streamed token by token.
How do I integrate Portuguese legal AI by API?
Create a key in the /developers portal, authenticate with the Authorization: Bearer header and send your message as JSON to the /api/v1/chat endpoint. The documentation includes ready-to-copy examples in cURL, JavaScript and Python.
Does the API have access to Portuguese legislation and case law?
Yes. The API searches Portuguese sources — such as dgsi.pt, dre.pt and the Constitutional Court — and returns every source in sources[] with its url, so answers are verifiable.
Is personal data sent to the AI model?
No. By default personal data is pseudonymized on a European model before it leaves; only the anonymized text reaches the generation model and the search, and the real values are reinserted on the TogaAI side during streaming. If anonymization fails, the request is blocked (fail-closed).
How much does the TogaAI legal API cost?
Billing is per token (input + output) of each request and the exact cost arrives in cost_micro (micro-EUR) on every response. New accounts get €2 of credit and the API wallet is separate from the app subscription.
Which languages can I use to call the API?
Any language that makes HTTP requests. The documentation includes examples in cURL, JavaScript (fetch) and Python (requests), with SSE streaming by default or a single JSON response (stream:false).
Start building with TogaAI.
Create your key in the dashboard, get €2 of credit and make your first call today.