# 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. *[View this page in the Flax docs](https://flax-analytics.com/docs/getting-started/quickstart-developers)* 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](/docs/developers/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: ```bash 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](/docs/api-reference/queries) for the full request and response shape, and the [API overview](/docs/api-reference/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: ```json { "mcpServers": { "flax": { "command": "flax-mcp", "env": { "FLAX_API_TOKEN": "flax_pat_..." } } } } ``` Or register it from the CLI: ```bash claude mcp add flax --env FLAX_API_TOKEN=flax_pat_... -- flax-mcp ``` See [MCP (local)](/docs/developers/mcp-local) for setup and the tools the agent gains. ## Next steps - [Authentication](/docs/developers/authentication) - [Queries API](/docs/api-reference/queries) - [API overview](/docs/api-reference/overview) - [MCP (local)](/docs/developers/mcp-local)