> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stratalerts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Market Status

> Returns the current open/closed state of the US stock market, active session details, session open and close timestamps, and the current server time in ET.

## Check whether the market is open

The market status endpoint returns a real-time snapshot of whether the US stock market is open, along with the details of the active session. Use this endpoint to gate time-sensitive logic in your integration — for example, to skip candle or price requests outside Regular Trading Hours (RTH), or to display market open/close countdowns in your UI.

**`GET https://app.stratalerts.com/api/market/v1/market-status`**

<Note>
  Requires scope: `metadata:read`
</Note>

## Request parameters

This endpoint accepts no query parameters.

## Response fields

<ResponseField name="market" type="string" required>
  The market this status applies to. Currently always `stocks`.
</ResponseField>

<ResponseField name="timezone" type="string" required>
  The timezone used for session timestamps. Always `America/New_York`.
</ResponseField>

<ResponseField name="is_open" type="boolean" required>
  `true` if the market is currently in a Regular Trading Hours (RTH) session, `false` otherwise (pre-market, after-hours, weekend, or holiday).
</ResponseField>

<ResponseField name="session" type="object" required>
  Details of the current or most recent RTH session. All timestamp fields are empty strings when `is_open` is `false`.

  <Expandable title="session object">
    <ResponseField name="label" type="string" required>
      Session type label. `RTH` during Regular Trading Hours, empty string otherwise.
    </ResponseField>

    <ResponseField name="session_date" type="string" required>
      The calendar date of the session in `YYYY-MM-DD` format. Empty string when `is_open` is `false`.
    </ResponseField>

    <ResponseField name="open_ts" type="string" required>
      ISO 8601 timestamp of the session open (e.g., `2026-04-10T09:30:00-04:00`). Empty string when `is_open` is `false`.
    </ResponseField>

    <ResponseField name="close_ts" type="string" required>
      ISO 8601 timestamp of the session close (e.g., `2026-04-10T16:00:00-04:00`). Empty string when `is_open` is `false`.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="now" type="string" required>
  The current server time as an ISO 8601 timestamp in the `America/New_York` timezone (e.g., `2026-04-10T14:35:00-04:00`). Use this to compute time-to-close or time-to-open without worrying about clock skew.
</ResponseField>

<Warning>
  StratAlerts only tracks Regular Trading Hours (RTH) sessions. Pre-market and after-hours periods return `is_open: false` even when exchange-traded products are actively trading on extended hours.
</Warning>

## Code examples

<CodeGroup>
  ```bash curl theme={null}
  curl "https://app.stratalerts.com/api/market/v1/market-status" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```python python theme={null}
  import requests
  from datetime import datetime

  resp = requests.get(
      "https://app.stratalerts.com/api/market/v1/market-status",
      headers={"Authorization": "Bearer YOUR_API_KEY"},
  )
  resp.raise_for_status()
  status = resp.json()

  if status["is_open"]:
      close_ts = status["session"]["close_ts"]
      now = status["now"]
      print(f"Market is open. Closes at {close_ts}. Current time: {now}")
  else:
      print("Market is closed.")
  ```

  ```javascript javascript theme={null}
  const resp = await fetch(
    "https://app.stratalerts.com/api/market/v1/market-status",
    { headers: { Authorization: "Bearer YOUR_API_KEY" } }
  );
  const status = await resp.json();

  if (status.is_open) {
    console.log(`Market is open. Closes at ${status.session.close_ts}.`);
    console.log(`Server time: ${status.now}`);
  } else {
    console.log("Market is closed.");
  }
  ```
</CodeGroup>

## Example responses

### Market open

```json theme={null}
{
  "market": "stocks",
  "timezone": "America/New_York",
  "is_open": true,
  "session": {
    "label": "RTH",
    "session_date": "2026-04-10",
    "open_ts": "2026-04-10T09:30:00-04:00",
    "close_ts": "2026-04-10T16:00:00-04:00"
  },
  "now": "2026-04-10T14:35:00-04:00"
}
```

### Market closed

```json theme={null}
{
  "market": "stocks",
  "timezone": "America/New_York",
  "is_open": false,
  "session": {
    "label": "",
    "session_date": "",
    "open_ts": "",
    "close_ts": ""
  },
  "now": "2026-04-10T18:12:00-04:00"
}
```

## Error codes

| HTTP status | Error code             | Meaning                                               |
| ----------- | ---------------------- | ----------------------------------------------------- |
| 401         | `missing_api_key`      | No API key was provided or the key format is invalid. |
| 403         | `inactive_entitlement` | Your account does not have an active API entitlement. |
| 403         | `missing_scope`        | Your API key does not have the `metadata:read` scope. |

Error responses use the following shape:

```json theme={null}
{
  "error": {
    "code": "missing_api_key",
    "message": "missing api key"
  }
}
```
