# Trailing per-time-of-day flow baseline (avg + stddev)

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

API: Flowseeker. Credits: 3.

Time-of-day baseline buckets for `{ticker}` — average and standard
deviation of trade count, premium, and FIR per intraday bucket over a
configurable lookback window. The reference distribution behind
`/v1/flow/{ticker}/momentum` z-scores.

## 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`). |
| `bucket` | query | string | no | Bucket size for the time series. Coarser buckets (`1d`, `1w`) are rejected on intraday endpoints. (one of `1min`, `5min`, `15min`, `30min`, `1h`; default `5min`) |
| `lookback_days` | query | integer | no | Trailing window size in trading days. (default `20`; min 1; max 30) |
| `start_time_of_day` | query | string | no | Lower bound of intraday window (HH:MM ET). (default `09:30`) |
| `end_time_of_day` | query | string | no | Upper bound of intraday window (HH:MM ET). (default `16:00`) |
| `min_dte` | query | integer | no |  (min 0) |
| `max_dte` | query | integer | no |  (min 0) |

## Example request

```bash
curl "https://flow-api.skylit.ai/v1/flow/SPY/baseline" \
  -H "Authorization: Bearer $SKYLIT_API_KEY"
```

## Responses

### 200

Per-bucket baseline statistics.

Shape (placeholder values):

```json
{
  "data": {
    "ticker": "string",
    "bucket": "string",
    "lookbackDays": 0,
    "startTimeOfDay": "string",
    "endTimeOfDay": "string",
    "buckets": [
      {
        "timeOfDay": "14:30",
        "daysCount": 0,
        "avgTradeCount": 0,
        "stddevTradeCount": 0,
        "avgPremium": 0,
        "stddevPremium": 0,
        "avgFir": 0,
        "stddevFir": 0
      }
    ],
    "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."
  }
}
```

### 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."
  }
}
```
