Quickstart for developers

The programmatic path — create a service account and API token, run a query over REST, and connect an agent to Flax over MCP.

This quickstart is for developers integrating Flax programmatically. You will create an API token, run a query over REST, and connect an AI agent through the Model Context Protocol (MCP).

#1. Create a service account and API token

Create a service account for machine access, then mint a personal access token for it. Tokens look like flax_pat_... and carry read or write scopes, so grant only what your integration needs. See Authentication.

Warning

A token is shown only once at creation. Store it in a secret manager, never in source control.

#2. Run your first query over REST

Send a query to the /api/query endpoint with your token in an Authorization: Bearer header:

curl -X POST https://flax-analytics.com/api/query \
  -H "Authorization: Bearer flax_pat_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sales",
    "dimensions": ["orders.status"],
    "measures": ["orders.count"]
  }'

The response returns the compiled result rows as JSON. See the Queries API for the full request and response shape, and the API overview for base URLs, pagination, and errors.

#3. Connect an agent via MCP

Flax ships an MCP server so agents can explore your models and run queries as tools. Add the local server to an MCP client such as Claude:

{
  "mcpServers": {
    "flax": {
      "command": "flax-mcp",
      "env": { "FLAX_API_TOKEN": "flax_pat_..." }
    }
  }
}

Or register it from the CLI:

claude mcp add flax --env FLAX_API_TOKEN=flax_pat_... -- flax-mcp

See MCP (local) for setup and the tools the agent gains.

#Next steps