---
title: "Getting started with the Flowsery Analytics API"
description: "The Flowsery Analytics API gives you programmatic access to analytics data across a workspace or a single website, from custom goals to revenue detail."
url: "https://flowsery.com/docs/api-introduction"
---

# Getting started with the Flowsery Analytics API

The Flowsery Analytics API lets you programmatically access your analytics data -- from tracking custom goals to fetching visitor details and more.

## 1. Create an API token or website key

Create a **workspace API token** from the workspace **API Tokens** page when you need programmatic access across every website in your workspace, including MCP and OpenClaw integrations. Workspace tokens use the `flow_ws_` prefix.

Create a **website API key** from a website's **Settings > API** page when you only need server-to-server access for one website, such as custom payment or goal tracking. Website keys use the `flow_` prefix.

Copy new secrets immediately because they are shown only once. Treat them like passwords: store them securely and never expose them in client-side code or public repositories.

## 2. Authenticate your requests

Every API call must include the `Authorization` header using the Bearer scheme. Substitute `YOUR_API_TOKEN` with the token or key you created.

`Authorization: Bearer YOUR_API_TOKEN`

## 3. Choose a website for workspace tokens

The base URL for all v1 endpoints is:
`https://analytics.flowsery.com/analytics/api/v1/`

When you authenticate with a workspace token, call [List websites](https://flowsery.com/docs/api-websites) first. Then pass either `websiteId` or `domain` to endpoint requests. For `GET` and `DELETE` endpoints, pass the selector as a query parameter. For `POST` endpoints such as goals and payments, pass it in the JSON body.

Website API keys are already scoped to one website, so they do not require `websiteId` or `domain`.

Here are a few common use cases to get you started:

- [List websites](https://flowsery.com/docs/api-websites)
- [Track a custom goal](https://flowsery.com/docs/api-create-goal)
- [Fetch visitor details](https://flowsery.com/docs/api-get-visitor)
- [Retrieve time series data](https://flowsery.com/docs/api-timeseries)

---

**Successful responses** return a `200 OK` status with a body structured as:

```json
{
  "status": "success",
  "data": { ... }
}
```

**Error responses** return the relevant HTTP status code (4xx or 5xx) with a body like:

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

Standard error codes:

- `400 Bad Request`: The input is invalid or required parameters are missing.
- `401 Unauthorized`: The API token is missing, invalid, expired, or not accepted for this endpoint.
- `404 Not Found`: The requested resource does not exist (e.g., unknown visitor).
- `500 Internal Server Error`: An unexpected issue occurred on the server.
