# Malegislature — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Check the live stream schedule for Massachusetts legislative sessions on any date to find when the General Court is broadcasting. Plan your viewing of state senate and house proceedings directly from the official legislature website.

**Category:** Government & Public Data | **Website:** [malegislature.gov/](https://malegislature.gov/) | **Docs:** [parse.bot/marketplace/1a50292e-6614-4bd9-805e-22be8702f50a/malegislature-gov-api](https://parse.bot/marketplace/1a50292e-6614-4bd9-805e-22be8702f50a/malegislature-gov-api)

Pay-per-use API proxy for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/malegislature/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## Endpoints

### Get events

Returns all hearings and events from the Massachusetts Legislature for a given month and year. Each event includes its time, status, type, title, location, video availability, and detail-page fields (video file URL, video start time, description, duration). Supports filtering by event type (Hearings, Sessions, SpecialEvents) and branch (Senate, House, Joint). Makes 1 + N requests (one list page plus one detail page per event). Returns an empty events array when no events match the filters.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `branch` | string | No | Filter by legislative branch. One of: Senate, House, Joint. When omitted, returns events from all branches. |
| `month` | integer | No | Month number (1-12). When omitted, defaults to the current UTC month. |
| `type` | string | No | Filter by event type. One of: Hearings, Sessions, SpecialEvents. When omitted, returns all hearings and events. |
| `year` | integer | No | Four-digit year (e.g. 2026). When omitted, defaults to the current UTC year. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/malegislature/get-events \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"branch":"<string>","month":"<integer>","type":"<string>","year":"<integer>"}'
```

### Get schedule

Returns all legislative hearings, sessions, and events for a specific date from the Massachusetts Legislature website. Hits the Calendar page filtered to the given date and visits each event's detail page for video, duration, and description info (1 + N requests where N is the number of events). Returns a sessions array of LiveMediaScheduleItem objects. When date is omitted, defaults to the current UTC date. Returns an empty sessions array when no events are scheduled for that date.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `date` | string | No | Date in YYYYMMDD format (e.g. 20260701). Events for this specific date are fetched. When omitted, defaults to the current UTC date. |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/credits/malegislature/get-schedule \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"date":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://beta.paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://beta.paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://beta.paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://beta.paywithlocus.com/agent/index.md): every Locus agent page.