Getting Started

Installation Guide

Install the Datafuse SDK for Python or TypeScript and set up the two credentials the API uses.

Datafuse is a plain HTTPS API. You can call it with curl, requests or fetch, connect any MCP client to it, or use the typed SDKs below. The SDKs are optional wrappers: every guide on this site also works without them.


Prerequisites

  • A Datafuse account at app.datafuse.xyz.
  • At least one integration connected on the Integrations page, showing credentials verified. Tool schemas and tool calls are only available on a verified connection.
  • Python 3.8 or newer, or Node.js 18 or newer.

Python SDK

bash
pip install datafuse-sdk

Check that it imports:

bash
python -c "import datafuse; print('Python SDK successfully installed!')"

See the Python client guide for usage.


TypeScript SDK

bash
npm install @datafuse/sdk

yarn add @datafuse/sdk and pnpm add @datafuse/sdk work the same way. The package ships compiled JavaScript with type declarations and has no runtime dependencies.

Check that it resolves:

bash
node -e "const { Datafuse } = require('@datafuse/sdk'); console.log('TypeScript SDK successfully installed!');"

See the TypeScript client guide for usage.


Credentials

Datafuse uses two credentials. Which one you need depends on the route.

CredentialWhere it comes fromLifetimeSend it as
API key (df_live_...)Settings > API keys in the dashboard. Shown once, when created.Until you delete itx-api-key: df_live_...
Access token (JWT)POST /api/v1/auth/login with your email and password30 minutesAuthorization: Bearer <token>
RoutesAPI keyAccess token
Run tools: resolve-tools, tools, tools/schema, invokeYesYes
MCP endpoint: /mcp, /mcp/{integration_id}YesYes
/api/v1/connected_accountsYes (x-api-key header only)No
Manage integrations: list, create, get, delete, testNoYes
Account routes: /api/v1/api-keys, /api/v1/audit/logs, billingNoYes
Browse the catalog: /api/v1/providersNot neededNot needed

In practice: an agent that only runs tools needs an API key and nothing else. Setting up or inspecting integrations needs an access token.

On the tool-running routes and /mcp, an API key is also accepted as Authorization: Bearer df_live_....

Get an access token

bash
curl -sS -X POST "https://api.datafuse.xyz/api/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "password": "your_password"}'

The response contains access_token and refresh_token. When the access token expires, exchange the refresh token for a new pair:

bash
curl -sS -X POST "https://api.datafuse.xyz/api/v1/auth/refresh" \
  -H "Content-Type: application/json" \
  -d '{"refresh_token": "your_refresh_token"}'

Environment variables

The guides on this site read these variables. The SDKs do not read them automatically: pass the values to the client yourself.

env
# API key from Settings > API keys. Runs tools and authenticates MCP clients.
DATAFUSE_API_KEY=df_live_your_key

# Access token from /api/v1/auth/login. Manages integrations. Expires after 30 minutes.
DF_TOKEN=your_access_token

# API host. Change this only for a self-hosted deployment.
DATAFUSE_API_URL=https://api.datafuse.xyz

Keep both credentials out of source control and out of model prompts.


Next Steps