Source: https://datafa.st/docs/api-realtime-map
Markdown source: https://datafa.st/docs/api-realtime-map.md
Description: Get real-time visitors, events, and recent payments for the realtime map.

# Get realtime map data

`GET https://datafa.st/api/v1/analytics/realtime/map`

Retrieve active visitors (last 10 minutes), recent events, and recent payments for the realtime map. Requires [Bearer Token](/docs/api-introduction) authentication.

## Response

**Success (200 OK):** Returns realtime map data

```json
{
  "status": "success",
  "data": {
    "count": 2,
    "visitors": [
      {
        "visitorId": "b971cbbf-7ce2-4925-902b-8f95a5fb3449",
        "location": {
          "city": "Denver",
          "region": "US-CO",
          "countryCode": "US"
        },
        "system": {
          "browser": { "name": "Chrome" },
          "os": { "name": "Mac OS" },
          "device": { "type": "desktop" }
        },
        "currentUrl": "/pricing",
        "referrer": null,
        "sessionStartTime": "2026-02-06T05:27:20.000Z",
        "visitCount": 1,
        "params": {
          "ref": null,
          "source": null,
          "via": null,
          "utm_source": null,
          "utm_medium": null,
          "utm_campaign": null,
          "utm_content": null,
          "utm_term": null
        },
        "latitude": 39.7391,
        "longitude": -104.9866,
        "isCustomer": false,
        "customerName": null,
        "customerEmail": null,
        "profileData": {
          "displayName": null,
          "userId": null,
          "hasProfile": false,
          "isRandomName": true
        },
        "conversionLikelihood": {
          "score": 65,
          "confidence": 0.763,
          "isBaseline": false,
          "dimensionMatches": ["device", "os", "browser", "country", "referrer"],
          "raw": {
            "conversionRate": 0.0056,
            "averageValue": 246.98,
            "expectedValue": 1.37
          }
        }
      }
    ],
    "conversionMetrics": {
      "baselineConversionRate": 0.0044,
      "baselineAverageValue": 243.63
    },
    "hasConversionPredictions": true,
    "recentEvents": [
      {
        "_id": "69857bb827ddefd472fb2b09",
        "type": "pageview",
        "visitorId": "b971cbbf-7ce2-4925-902b-8f95a5fb3449",
        "timestamp": "2026-02-06T05:27:20.000Z",
        "path": "/pricing",
        "countryCode": "US",
        "extraData": {},
        "referrer": null,
        "customerName": null,
        "amount": null,
        "displayName": null
      }
    ],
    "recentPayments": [
      {
        "_id": "69857bb827ddefd472fb2b12",
        "type": "payment_received",
        "timestamp": "2026-02-06T05:26:10.000Z",
        "name": "Jane Doe",
        "email": "jane@example.com",
        "amount": 49,
        "currency": "USD",
        "renewal": false,
        "displayName": null,
        "isNew": false,
        "visible": true
      }
    ]
  }
}
```

## Notes

- Time window is the last **10 minutes** for active visitors, recent events, and recent payments.
- `conversionLikelihood` and `conversionMetrics` are included only when conversion modeling data is available.
- `hasConversionPredictions` will be `false` when no conversion metrics exist yet.

## Errors

- **401 Unauthorized:** Missing or invalid API key
- **404 Not Found:** Website not found
- **500 Internal Server Error:** Server-side issue

## Code examples

### Example request (Node.js/Express)

```javascript
const response = await fetch(
  "https://datafa.st/api/v1/analytics/realtime/map",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${DATAFAST_API_KEY}`,
      "Content-Type": "application/json",
    },
  }
);

const result = await response.json();
console.log(result);
```

### Success response (200 OK)

```json
{
  "status": "success",
  "data": {
    "count": 2,
    "visitors": [ ... ],
    "recentEvents": [ ... ],
    "recentPayments": [ ... ],
    "hasConversionPredictions": true
  }
}
```
