> Site index: https://usehardal.com/llms.txt
> Every content route also serves markdown at <url>.md

# Pull Session Logs and Session Timelines With the Hardal Reports API

The Reports API now has session-level endpoints. List sessions for a period, then fetch any session's event timeline with user IDs attached.

Source: https://usehardal.com/blog/reports-api-session-log-detail
Published: 2026-12-03T10:00:00
Updated: 2026-12-03T10:00:00
Author: Ikbal Turgut
Category: Agentic Commerce

---

Hardal is the first-party data and agentic analytics platform. We help enterprises send accurate signals to their ad platforms and grow revenue, using server-side data from their websites, mobile apps and AI agents.

The public Reports API at `api.usehardal.com/v1` now has two session-level endpoints. If you already use the [Hardal MCP and the /v1 Reports API](https://usehardal.com/blog/hardal-mcp-reports-api) for aggregate reports, these additions let you work with session data programmatically.

## What shipped

Two new endpoints:

**Session log:** `GET /v1/reports/sessions` returns a list of sessions for a time period, the same data you see in the Session Log in the dashboard.

**Session detail:** `GET /v1/reports/sessions/{sessionId}/detail` returns the event timeline for one session, the same data the Session Overview side panel shows. Each event in the timeline now includes the `userId` it was sent with.

Both endpoints use the existing `reports:read` scope and respect the same tenant and source access controls as the other Reports API endpoints.

## Why this matters

Session-level data connects events to the visitor who triggered them. When a customer says something went wrong during checkout, you can find the session and see what happened step by step, without opening the dashboard.

**Support workflows.** Look up a session by its ID, pulled from your logs or CRM, and see the visitor's path through your site. The timeline shows which pages they viewed, which events fired, and in what order.

**Tracking verification.** Compare what your site sent against what Hardal received. The session detail endpoint returns every event in the session, so you can confirm that the expected page views, add-to-carts, and purchases arrived.

**User matching.** Each timeline event carries the `userId` it was sent with. If your site sends a signed-in user identifier, you can match sessions to users in your backend without manual correlation.

**Integrations.** Build dashboards, QA tools, or AI workflows that need session context. The API gives you the same data the dashboard shows, in a format you can process.

## How to use the session log

### 1. Get an API key

Create a read-only API key on the Connections page in Beacon. The key must have access to the tenant you want to query. For detailed steps, see [Hardal MCP and the /v1 Reports API](https://usehardal.com/blog/hardal-mcp-reports-api).

### 2. Call the endpoint

Make a GET request with your tenant ID and time range:

```bash
curl -X GET "https://api.usehardal.com/v1/reports/sessions?tenantId=YOUR_TENANT_ID&startDate=2026-12-01&endDate=2026-12-03" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

The `sourceId` parameter is optional on this endpoint. If you omit it, the response includes sessions from all sources your credential can access. Add `sourceId=YOUR_SOURCE_ID` to filter to a specific source.

### 3. Page through results

For large result sets, use `limit` and `offset`:

```bash
curl -X GET "https://api.usehardal.com/v1/reports/sessions?tenantId=YOUR_TENANT_ID&startDate=2026-12-01&endDate=2026-12-03&limit=50&offset=100" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

The response includes a total count so you can calculate how many pages exist.

## How to use session detail

### 1. Find the session ID

Session IDs come from:

- The session log endpoint
- The Session Log in the dashboard
- Your own logs if you record session IDs at tracking time

### 2. Call the endpoint

Make a GET request with the session ID and source ID:

```bash
curl -X GET "https://api.usehardal.com/v1/reports/sessions/SESSION_ID/detail?sourceId=YOUR_SOURCE_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

The `sourceId` parameter is required on the detail endpoint.

### 3. Use the date hint (optional)

If you know roughly when the session happened, add a `date` parameter in `YYYY-MM-DD` format:

```bash
curl -X GET "https://api.usehardal.com/v1/reports/sessions/SESSION_ID/detail?sourceId=YOUR_SOURCE_ID&date=2026-12-02" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

The hint narrows the lookup and keeps it fast for large event volumes.

## What the response includes

**Session log response (illustrative shape):**

```json
{
  "sessions": [
    {
      "sessionId": "abc123",
      "startTime": "2026-12-02T14:23:11Z",
      "duration": 342,
      "entryPage": "/products/earbuds",
      "exitPage": "/checkout/complete",
      "pageCount": 5,
      "eventCount": 12,
      "visitorId": "visitor_xyz",
      "userId": "user_456"
    }
  ],
  "total": 1842
}
```

**Session detail response (illustrative shape):**

```json
{
  "sessionId": "abc123",
  "events": [
    {
      "time": "2026-12-02T14:23:11Z",
      "eventName": "page_view",
      "page": "/products/earbuds",
      "userId": "user_456"
    },
    {
      "time": "2026-12-02T14:24:02Z",
      "eventName": "add_to_cart",
      "page": "/products/earbuds",
      "userId": "user_456"
    }
  ]
}
```

These are illustrative. The OpenAPI document and the Reports API v1 Postman collection describe the full response schemas.

## Error responses

Both endpoints return standard HTTP status codes:

- **400 Bad Request**: The `sourceId` parameter is missing on the detail endpoint, the `date` parameter is not in `YYYY-MM-DD` format, or required parameters are invalid.
- **404 Not Found** with error code `session-not-found`: The session does not exist, or it belongs to a source your credential cannot access.

If you get a 404 and you are sure the session exists, check that your API key has access to the correct source.

## Access controls and privacy

These endpoints return visitor-level data: visitor IDs, user IDs, page paths, and location fields attached to sessions. Access is limited to tenants and sources your API credential is granted.

Handle your API keys carefully. A credential with access to session data can read the same visitor-level information the dashboard shows. Store keys securely and revoke them promptly when no longer needed.

The same `reports:read` scope that the other Reports API endpoints use applies here. The endpoints follow the existing per-credential and per-tenant rate limits.

## Single-event lookup

If you need to inspect a single event by its ID, see [Look Up Any Event by ID with the Hardal Reports API](https://usehardal.com/blog/reports-api-event-detail). The event detail endpoint complements session detail for cases where you have an event ID and want to verify its properties directly.

## Documentation

Both endpoints are listed in the OpenAPI document and the Postman collection for the Reports API v1.

## Connect it to your workflow

If you already use the Reports API for dashboards or scripts, adding session queries is two more GET requests. The session log gives you the list; session detail gives you the timeline. Combined with [single-event lookup](https://usehardal.com/blog/reports-api-event-detail) and the [aggregate reports](https://usehardal.com/blog/hardal-mcp-reports-api), the API now covers the same data the dashboard shows, from summaries down to individual events.

For teams building support tooling or AI workflows, the session timeline is the missing piece. You can answer "what did this visitor do in this session" without asking someone to open the dashboard and read a screenshot.
