---
title: "Premiers pas avec l'API Flowsery Analytics"
description: "L'API Flowsery Analytics donne un accès programmatique à vos données analytiques : des objectifs personnalisés aux détails visiteurs et aux revenus."
url: "https://flowsery.com/fr/docs/api-introduction"
---

# Premiers pas avec l'API Flowsery Analytics

L'API Flowsery Analytics vous permet d'accéder programmatiquement à vos données analytiques -- du suivi d'objectifs personnalisés à la récupération de détails visiteurs et plus encore.

## 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)

---

**Les réponses réussies** retournent un statut `200 OK` avec un corps structuré comme suit :

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

**Les réponses d'erreur** retournent le code de statut HTTP correspondant (4xx ou 5xx) avec un corps comme :

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

Codes d'erreur standard :

- `400 Bad Request` : L'entrée est invalide ou des paramètres requis sont manquants.
- `401 Unauthorized` : La clé API est manquante ou invalide.
- `404 Not Found` : La ressource demandée n'existe pas (ex. visiteur inconnu).
- `500 Internal Server Error` : Un problème inattendu est survenu sur le serveur.
