API
FrançaisAPI: getting started
Ask questions about your Odoo, PostgreSQL or MySQL data from your own code, scripts and automations, and get the answer back as text, tables and figures. Read-only: the API never changes your data.
What the API does
- Ask a question in plain language about one of your connections, and get the answer as text, as structured
json(tables and figures) or as a ready-to-send email. - Read an answer later when it takes longer than you want to wait.
- List your connections. Every new workspace also has sample connections with fictional data, so you can try the API before connecting your own.
Only asking costs a prompt: 1 prompt per answer. Every other call is free.
Create an API key
Only workspace owners and admins can create keys. The key is shown once: copy it then.
Send the key on every request, as x-api-key: <key> or Authorization: Bearer <key>. A key belongs to one workspace. Keep it secret: anyone with it can ask questions on your workspace.
Your first call
1. Check the key. The answer names your workspace and the prompts it has left (free).
curl https://speaktoyourdatabase.com/api/v1/context \ -H "x-api-key: $STYD_API_KEY"
2. Ask a question. connectionId is an id from GET /connections (in a new workspace, try a sample connection). This uses 1 prompt.
curl "https://speaktoyourdatabase.com/api/v1/chat?format=json" \
-H "x-api-key: $STYD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "connectionId": 3, "prompt": "How many customers are there?" }'The answer comes back within 90 seconds (200). If it takes longer you get 202 with a runId: call GET /runs/{runId}?wait=30 until its status is complete.
Go further
Every endpoint, field, error code and limit is in the API reference, where you can also try each request with your key. No code? Use the Make app.