Build with air quality data. Access real-time sensor readings, historical analytics, and export tools through our REST API, GraphQL, CLI, and MCP integrations.
Get up and running in seconds. The latest reading endpoint is public. Device registry, export, and write endpoints require a Bair1 API key.
curl https://www.bair1.live/api/readings/latestcurl https://www.bair1.live/api/v1/devices \
-H "Authorization: Bearer $BAIR1_API_KEY"npm install @heysalad/bair1
import { Bair1Client } from "@heysalad/bair1";
const bair1 = new Bair1Client({ apiKey: process.env.BAIR1_API_KEY });
const latest = await bair1.latest();All endpoints return JSON. Use an API key for device registry, exports, and writes. Pass it via the Authorization header or the x-api-key header.
/api/v1/devicesList all registered sensors with their metadata and status.
/api/v1/devices/:id/readingsRetrieve historical readings for a specific device.
Params: ?limit, ?from, ?to
/api/v1/devices/:id/analyticsGet aggregated statistics and analytics for a device.
/api/v1/exportExport readings in CSV or JSON format.
Params: ?format, ?device, ?from, ?to
/api/readings/latestGet the most recent reading across all devices.
/api/readingsSubmit a new sensor reading. Requires API key authentication.
curl "https://www.bair1.live/api/v1/devices/XIAO-SPS30-5EAA7A/readings?limit=10&from=2026-01-01" \
-H "Authorization: Bearer $BAIR1_API_KEY"For more flexible queries, use the GraphQL endpoint at /api/graphql. Supports introspection.
curl -X POST https://www.bair1.live/api/graphql \
-H "Content-Type: application/json" \
-d '{
"query": "{
registeredDevices {
deviceId
name
latestReading {
pm25
pm10
timestamp
}
}
}"
}'Connect Bair1 to AI agents like Claude Desktop or Claude Code using the Model Context Protocol. Add the following to your MCP configuration:
{
"mcpServers": {
"bair1": {
"command": "npx",
"args": ["-y", "@heysalad/bair1-mcp"],
"env": {
"BAIR1_API_KEY": "your-api-key"
}
}
}
}Once connected, your AI agent can query air quality data, list devices, and analyze trends through natural language.
A command-line interface for quick access to Bair1 data from your terminal.
npm install -g @heysalad/bair1# Save your API key for authenticated endpoints
bair1 config set-key "$BAIR1_API_KEY"
# Get the latest reading
bair1 latest
# List all devices
bair1 devices
# Export data as CSV
bair1 export --device XIAO-SPS30-5EAA7A --format csvAgent tools can query Bair1 through MCP, the JavaScript SDK, or the REST API. MCP is the best default for coding agents because it exposes Bair1 as named tools instead of requiring custom glue code.
Use the MCP server when the environment supports MCP tools, or import the SDK in local scripts.
# MCP command
npx -y @heysalad/bair1-mcp
# SDK command
npm install @heysalad/bair1Register the MCP server once, then ask Claude to inspect readings, devices, and exports.
claude mcp add bair1 \
-e BAIR1_API_KEY=$BAIR1_API_KEY \
npx -y @heysalad/bair1-mcpAdd the Bair1 MCP server to your MCP configuration and keep the API key in the environment.
{
"mcpServers": {
"bair1": {
"command": "npx",
"args": ["-y", "@heysalad/bair1-mcp"]
}
}
}Use the same stdio MCP command if your workspace supports custom MCP servers.
BAIR1_API_KEY=your-api-key \
npx -y @heysalad/bair1-mcpBair1 firmware can post sensor readings directly to the API or to a relay when the network path needs TLS or cellular handling.
POST https://www.bair1.live/api/readings
Authorization: Bearer $BAIR1_API_KEY
Content-Type: application/json
{
"deviceId": "YOUR_DEVICE_ID",
"deviceName": "Bair1 Sensor",
"family": "bair1",
"pm25": 8.4,
"pm10": 13.2,
"aqi": 34,
"transport": "wifi"
}# For SIM800L or cellular paths, send to the relay
POST https://sensor.heysalad.app/api/readings
# The relay forwards to:
https://www.bair1.live/api/readingspip install bair1
Coming Soonnpm install @heysalad/bair1
Ready to publishQuestions? Reach out at developers@bair1.live