TogaAI API
The legal APIfor 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.
Your request. Authenticate with your key, send the message and choose the mode.
answer
The landlord João Silva may oppose the renewal by notifying the tenant in writing with the legal advance notice required for the term in question, under article 1097 of the Portuguese Civil Code. The notice must be sent by registered letter with acknowledgement of receipt.
Anonymization
EU · Frankfurt- NameJoão SilvaPerson A
- Tax number234 567 890NIF 1
Fail-closed: blocks if it can’t anonymize
Generation modelsees only pseudonyms
The landlord Person A, tax number NIF 1, wants to oppose the renewal of the lease. How should he do it?
Real values reinserted
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.
Need a single block? stream: false returns JSON.
- sources
- First, the sources.
- chunk
- Then the answer, in a continuous stream.
- done
- The cost (
cost_micro) arrives in the final event.
Privacy by architecture
The model never seespersonal 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.
| In your request | The model sees |
|---|---|
| Names | Person A |
| Tax numbers | NIF 1 |
| Addresses | Address 1 |
| Contacts | Phone 1 · Email 1 |
| IBAN | IBAN 1 |
| License plates | Plate 1 |
- Processing in the EU · Frankfurt
- Fail-closed: blocks if it can’t anonymize
- Reinsertion during streaming
anonymize: true (default)
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 itsurl.Mode and effort, per request
fast/deepandlow/medium/highon 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:falsereturns JSON.Cost in plain sight on every response
Each response carries
cost_micro(micro-EUR) andusagewith 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://www.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 tokensinput + 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://www.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.
- https://www.togai.pt/api/v1
- SSE streaming by default
- €2 of credit to start
- API wallet separate from the app subscription