Developers
The console is built on these APIs, and so is everything else.
Embed a report, sign your users in, pull rows out of a model or script the console, and every call runs under the caller’s own permissions.
HTML
<div id="report" style="height: 720px"></div>
<script>window.__dataforSDKBase = 'https://bi.example.com/datafor/content/datafor/ui/';</script>
<script src="https://bi.example.com/datafor/content/datafor/ui/datafor-loader.js"></script>
<script>
const el = document.getElementById('report');
function open(options) {
return new Datafor.Visualizer(Object.assign({
el,
serverUrl: 'https://bi.example.com', // origin only, no /datafor
jwt: tokenFromYourBackend, // see "Sign a token"
onRedirectEvent: (next) => open(next), // page, mode or drill-through changed
}, options));
}
const report = open({ path: '/public/Retail/Executive Cockpit.datafor', mode: 'read' });
</script>Node.js
// On your server. The signing key never reaches the browser.
import jwt from 'jsonwebtoken';
app.get('/datafor-token', requireLogin, (req, res) => {
const token = jwt.sign(
{
loginname: req.user.dataforLogin, // the configuration's Username field
name: req.user.fullName,
email: req.user.email,
},
process.env.DATAFOR_EMBED_SECRET, // the configuration's Secret key
{ algorithm: 'HS256', expiresIn: '15m' }
);
res.json({ token });
});curl
curl -u analyst:••••••• -X POST \
"https://bi.example.com/datafor/plugin/datafor/api/cube/query/executeSimple" \
-H "Content-Type: application/json" \
-d '{
"name": "q-7f3c2a",
"schema": "Retail Chain Operations",
"cube": "Retail Chain Operations",
"rows": ["[Store].[Store Hierarchy].[region]"],
"measures": ["Net Sales", "Sales Quantity"],
"filters": [{
"uniqueName": "[Date].[full_date].[full_date]",
"comparator": "between",
"value": ["2026-01-01", "2026-03-31"]
}],
"topRows": [{ "type": "top", "limit": 3, "measure": "Net Sales" }]
}'Terminal
claude mcp add --transport http datafor "<MCP address>" \
--header "Authorization: Bearer <personal token>"
# then, in Claude Code:
# "Use Datafor: net sales by region for the first quarter, top three."curl
# 1. A session: sign in once, keep the cookie
curl -c jar.txt -X POST "https://bi.example.com/datafor/plugin/datafor/api/extension/auth/login" \
-d "username=ops-bot" -d "password=•••••••"
curl -b jar.txt "https://bi.example.com/datafor/plugin/datafor-modeler/api/user/detail"
# 2. HTTP Basic, no login call
curl -u ops-bot:••••••• "https://bi.example.com/datafor/plugin/datafor-modeler/api/user/detail"
# 3. A signed JWT
curl -H "Authorization: Bearer <signed-jwt>" \
"https://bi.example.com/datafor/plugin/datafor-modeler/api/user/detail"Four ways in
| Way in | What it is for | Who it runs as | Reference |
|---|---|---|---|
| JavaScript SDK | A report, or the report designer, drawn in your own page. | An embed token your backend signs | SDK embedding |
| Query API | Rows from a model as JSON. | Session, HTTP Basic or a JWT | API reference |
| REST API | Everything the console does, from a script. | Session, HTTP Basic or a JWT | API reference |
| MCP server | Questions from Claude, ChatGPT, Cursor and any MCP client. | A personal token, read-only | Connect guide |
Query API
Ask the model for rows and draw them yourself
Name the measures and the levels, and Datafor writes the query, applies the caller’s rules and hands back JSON.
Request
curl -u analyst:••••••• -X POST \
"https://bi.example.com/datafor/plugin/datafor/api/cube/query/executeSimple" \
-H "Content-Type: application/json" \
-d '{
"name": "q-7f3c2a",
"schema": "Retail Chain Operations",
"cube": "Retail Chain Operations",
"rows": ["[Store].[Store Hierarchy].[region]"],
"measures": ["Net Sales", "Sales Quantity"],
"filters": [{
"uniqueName": "[Date].[full_date].[full_date]",
"comparator": "between",
"value": ["2026-01-01", "2026-03-31"]
}],
"topRows": [{ "type": "top", "limit": 3, "measure": "Net Sales" }]
}'Response
{
"hasMore": false,
"chartData": [
{ "Region": "East", "Net Sales": 239148.49, "Sales Quantity": 2555 },
{ "Region": "South", "Net Sales": 167889.45, "Sales Quantity": 1852 },
{ "Region": "Southwest", "Net Sales": 135218.74, "Sales Quantity": 1339 }
],
"metaData": [ ... ]
}Try it against your own app.
A ninety-day trial runs on your own servers, and every call on this page works against its sample data.