# Aggregate flow over an arbitrary [start, end] window

`GET https://flow-api.skylit.ai/v1/flow/{ticker}/aggregate`

API: Flowseeker. Credits: 3.

Server-side aggregation across an arbitrary `[startTime, endTime]`
window — no row cap. Returns trade/sweep counts, VWF/SDF/FIR, and a
bullish/bearish/neutral premium split with a one-line interpretation.
Useful for arbitrary slicing without paging the full trade list.

## Authentication

Send your Skylit API key as a bearer token: `Authorization: Bearer <key>`. No other header is accepted.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `ticker` | path | string | yes | Underlying ticker symbol (uppercase, e.g. `SPY`, `AAPL`). |
| `start_time` | query | string | yes | Lower bound of the window. Accepts RFC 3339 (`2026-05-27T13:30:00Z`) or Unix seconds. |
| `end_time` | query | string | yes | Upper bound of the window (RFC 3339 or Unix seconds). |
| `option_type` | query | string | no |  (one of `call`, `put`, `all`; default `all`) |
| `min_premium` | query | number (double) | no |  |
| `exclude_multi_leg` | query | boolean | no | Exclude trades flagged as part of a multi-leg structure. (default `false`) |
| `min_dte` | query | integer | no |  (min 0) |
| `max_dte` | query | integer | no |  (min 0) |
| `date` | query | string (date) | no |  |

## Example request

```bash
curl "https://flow-api.skylit.ai/v1/flow/SPY/aggregate?start_time=2026-05-27T13:30:00Z&end_time=2026-05-27T20:00:00Z" \
  -H "Authorization: Bearer $SKYLIT_API_KEY"
```

## Responses

### 200

Window-aggregated flow scores.

Shape (placeholder values):

```json
{
  "data": {
    "ticker": "string",
    "startTime": "string",
    "endTime": "string",
    "tradeCount": 0,
    "sweepCount": 0,
    "totalPremium": 0,
    "aggregate": {
      "vwf": 0,
      "sdf": 0,
      "fir": 0,
      "composite": 0
    },
    "premiumSplit": {
      "bullishPremium": 0,
      "bearishPremium": 0,
      "neutralPremium": 0,
      "netPremium": 0,
      "bullishCount": 0,
      "bearishCount": 0,
      "neutralCount": 0,
      "sweepPremium": 0
    },
    "interpretation": {
      "bias": "bullish",
      "signalStrength": "strong"
    },
    "queryTimeMs": 0
  },
  "meta": {
    "timestamp": "string",
    "requestId": "d7574836"
  }
}
```

### 400

Request validation failed.

invalidParam:

```json
{
  "error": {
    "code": "BAD_REQUEST",
    "message": "Invalid parameter 'timeframe': must be one of [1m, 5m, 15m, 1h, 4h, 1d, 1w, 1M]"
  }
}
```

### 401

Missing or invalid API key.

missingKey:

```json
{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Authentication required"
  }
}
```

### 402

The account's shared Skylit credit balance is lower than this route's cost. Top up to continue. Carries `X-Credits-Remaining: 0`.

Headers: `X-Credits-Remaining`.

outOfCredits:

```json
{
  "error": {
    "code": "insufficient_credits",
    "message": "Out of credits. Top up to continue making requests."
  }
}
```

### 403

API key invalid, revoked or expired, or the account's API access is suspended (`account_suspended`).

accountSuspended:

```json
{
  "error": {
    "code": "account_suspended",
    "message": "API access has been suspended for this account. Contact support."
  }
}
```

### 404

Unknown resource (ticker / sector / window with no data).

noData:

```json
{
  "error": {
    "code": "NOT_FOUND",
    "message": "No trades found for AAPL on 2026-05-27 with timeframe 1d"
  }
}
```

### 429

Per-minute rate limit exceeded.

Headers: `Retry-After`.

tooFast:

```json
{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Rate limit of 100 req/min exceeded. Retry after 18s."
  }
}
```

### 503

Underlying data source temporarily unavailable, or the credit balance could not be verified (`credit_check_failed`). Safe to retry.

ingestionLag:

```json
{
  "error": {
    "code": "UNAVAILABLE",
    "message": "Live feed is degraded; please retry in a few seconds."
  }
}
```

creditCheckFailed:

```json
{
  "error": {
    "code": "credit_check_failed",
    "message": "Could not verify credit balance. Please retry."
  }
}
```
