parcllabs-rust
Rust SDK for the Parcl Labs API — real-time U.S. housing market data covering 70,000+ markets. 53 endpoints across 9 services with automatic pagination, retry logic, and credit tracking.
Installation
[]
= "0.1"
= { = "1", = ["full"] }
Quick Start
use ;
async
Authentication
# from dashboard.parcllabs.com
// From environment
let client = new?;
// Explicit key
let client = with_api_key;
// Custom base URL
let client = with_config;
Services
All metric services follow the same pattern: GET for a single market by parcl_id, batch POST for multiple markets at once.
Search
use ;
let params = new
.query
.state
.location_type
.sort_by
.sort_order
.limit;
let markets = client.search.markets.await?;
Market Metrics
use ;
let params = new
.property_type
.start_date;
let events = client.market_metrics.housing_event_counts.await?;
let prices = client.market_metrics.housing_event_prices.await?;
let stock = client.market_metrics.housing_stock.await?;
let cash = client.market_metrics.all_cash.await?;
let attrs = client.market_metrics.housing_event_property_attributes.await?;
Investor Metrics
let ownership = client.investor_metrics.housing_stock_ownership.await?;
let ratio = client.investor_metrics.purchase_to_sale_ratio.await?;
let counts = client.investor_metrics.housing_event_counts.await?;
let prices = client.investor_metrics.housing_event_prices.await?;
let listings = client.investor_metrics.new_listings_for_sale_rolling_counts.await?;
For-Sale Metrics
let inventory = client.for_sale_metrics.for_sale_inventory.await?;
let price_changes = client.for_sale_metrics.for_sale_inventory_price_changes.await?;
let new_listings = client.for_sale_metrics.new_listings_rolling_counts.await?;
Rental Metrics
let yields = client.rental_metrics.gross_yield.await?;
let concentration = client.rental_metrics.rental_units_concentration.await?;
let new_rentals = client.rental_metrics.new_listings_for_rent_rolling_counts.await?;
Price Feed
let sale_feed = client.price_feed.history.await?;
let rental_feed = client.price_feed.rental_history.await?;
New Construction Metrics
use NewConstructionMetricsParams;
let counts = client.new_construction_metrics.housing_event_counts.await?;
let prices = client.new_construction_metrics.housing_event_prices.await?;
Portfolio Metrics
Track activity by portfolio size (2-9 units, 10-99, 100-999, 1000+).
use ;
let params = new
.portfolio_size;
let ownership = client.portfolio_metrics.sf_housing_stock_ownership.await?;
let events = client.portfolio_metrics.sf_housing_event_counts.await?;
let sales = client.portfolio_metrics.sf_new_listings_for_sale_rolling_counts.await?;
let rentals = client.portfolio_metrics.sf_new_listings_for_rent_rolling_counts.await?;
Property API
Search individual properties with granular filters.
use ;
// Search properties (GET v1)
let params = new
.property_type
.limit;
let props = client.property.search.await?;
// Search by address (POST v1)
let addresses = vec!;
let results = client.property.search_by_address.await?;
// Event history (POST v1)
let params = new
.parcl_property_ids;
let history = client.property.event_history.await?;
Batch Queries
Every metric endpoint has a batch_* variant that accepts multiple parcl_ids in a single request. Each response item includes parcl_id for identification.
let ids = vec!; // LA and NYC
let params = new.limit;
let resp = client.market_metrics
.batch_housing_event_counts
.await?;
for item in &resp.items
All services support batch: batch_housing_stock(), batch_all_cash(), batch_for_sale_inventory(), batch_gross_yield(), batch_history(), etc.
Retry & Rate Limiting
Automatic retry with exponential backoff on HTTP 429 responses. Configurable via RetryConfig.
use RetryConfig;
// Default: 3 retries, 1s initial backoff (doubles each attempt)
let client = new?;
// Custom retry config
let client = with_api_key
.with_retry_config;
// Disable retries
let client = with_api_key
.with_retry_config;
If all retries are exhausted, returns ParclError::RateLimited.
Credit Tracking
API credit usage is tracked automatically from response bodies.
let client = new?;
// Make some requests...
let _ = client.market_metrics.housing_event_counts.await?;
let _ = client.market_metrics.housing_stock.await?;
// Session-level credit tracking
println!;
println!;
// Or get both at once
let usage = client.account_info;
println!;
Per-response credit info is also available on every response:
let resp = client.market_metrics.housing_event_counts.await?;
if let Some = &resp.account
Auto-Pagination
All services support transparent pagination:
let params = new
.start_date
.auto_paginate;
let history = client.market_metrics
.housing_event_counts
.await?;
println!;
Works for both GET and batch POST endpoints.
Error Handling
use ;
match client.search.markets.await
Examples
API Coverage
53 endpoints across 9 services
| Service | GET Endpoints | Batch POST |
|---|---|---|
| Search | markets |
— |
| Market Metrics | housing_event_counts, housing_event_prices, housing_stock, all_cash, housing_event_property_attributes |
All 5 |
| Investor Metrics | housing_stock_ownership, purchase_to_sale_ratio, housing_event_counts, housing_event_prices, new_listings_for_sale_rolling_counts |
All 5 |
| For-Sale Metrics | for_sale_inventory, for_sale_inventory_price_changes, new_listings_rolling_counts |
All 3 |
| Rental Metrics | gross_yield, rental_units_concentration, new_listings_for_rent_rolling_counts |
All 3 |
| Price Feed | history, rental_history |
Both |
| New Construction | housing_event_counts, housing_event_prices |
Both |
| Portfolio Metrics | sf_housing_stock_ownership, sf_housing_event_counts, sf_new_listings_for_sale_rolling_counts, sf_new_listings_for_rent_rolling_counts |
All 4 |
| Property | search (GET), search_by_address (POST), event_history (POST), search_v2 (POST) |
— |
License
MIT