"Best analytics tool I've used in 14 years"

Get started with the DataFast API

Use the DataFast API to read analytics, send server-side events, and manage your DataFast account from your own backend, scripts, or AI agents.

There are two API surfaces:

SurfaceTokenUse it for
Website APIdf_ website API keyRead analytics, list visitors, send goals, send payments, identify users, or query one website
Account APIdft_ account tokenManage websites, create API keys, create funnels, manage alerts, invite team members, connect integrations, or let an AI agent manage your account
CLIdft_ or df_Run the same workflows from a terminal with datafast

Which one should I use?

Base URL

The base URL for all v1 endpoints is:

https://datafa.st/api/v1/

Authenticate requests

All API requests use a Bearer token:

Authorization: Bearer YOUR_TOKEN
Create website API keys in Website settings -> API. Create account tokens in Account settings -> API, or with datafast tokens create.

Keep both token types secret. Do not expose them in frontend code or public repositories.

Get API keys from the dashboard

How to get a DataFast website API key (df_)

Create a website API key from Website settings -> Developer. If you are signed in, use the website selector in this docs header to switch the link to another website.

Create a DataFast website API key

How to get a DataFast account API token (dft_)

Create an account API token from Account settings -> API. Use account tokens for CLI sessions, AI agents, and account automation.

Create a DataFast account API token

Common use cases

Try the API playground to test website and account API endpoints interactively.

Successful requests return a 200 OK status and a body like:
{
  "status": "success",
  "data": { ... } // Endpoint-specific data
}

Errors

Most failed requests return an appropriate HTTP status code and a JSON error body:

{
  "status": "error",
  "error": {
    "code": HTTP_STATUS_CODE,
    "message": "A descriptive error message"
  }
}

Common error codes:

CodeMeaningCommon causes
400Bad requestMissing required fields, invalid JSON body, invalid query parameter, invalid date range, invalid ObjectId, invalid enum value
401UnauthorizedMissing Authorization header, invalid token, wrong token prefix, expired or revoked key
403ForbiddenToken does not have the required permission, account does not have API access, token cannot access the requested website, role does not allow the write action
404Not foundWebsite, visitor, funnel, alert, API key, token, or other resource does not exist or is not accessible to the token
409ConflictResource already exists, such as a duplicate website, pending invite, or duplicate funnel name
429Rate limitedToo many requests for the same token. Check the X-RateLimit-* response headers
500Server errorUnexpected server-side error
504TimeoutA long-running delete operation timed out. Retry with a smaller time range
Some endpoints can return endpoint-specific errors. For example, website deletion is dashboard-only and returns 403, and POST /api/v1/payments returns a plain { "error": "..." } body for validation errors.

Rate-limited responses include:

{
  "error": "Too many requests",
  "message": "Rate limit exceeded...",
  "limit": 60,
  "remaining": 0,
  "reset": 1716249600
}

✍️ Something missing? Suggest features.

🤖 AI agent or LLM? Read this page as markdown