My Developer Portal

Getting Started with LaborLens API

Get up and running with the LaborLens API in just a few minutes. This guide will walk you through authentication, API key creation, and making your first API call.

Quick Start

  1. Create Your Account & API Key

    To access the LaborLens API, you'll need to create an account and generate an API key:

    1. Sign up: Click the "Login" button in the top navigation and create your account
    2. Access API Keys: Navigate to Access & Usage in the portal
    3. Generate Key: Click "Create API Key"
    4. Save Securely: Your API key will be available, and retrievable immediately. Be sure to protect these credentials.

    Keep your API key secure! Never share it publicly or commit it to version control. Store it securely as an environment variable.

  2. Make Your First API Call

    Test your setup with a simple request to get available industries:

    TerminalCode
    curl -X GET "https://laborpulse-api-main-86f2470.zuplo.app/industries" \ -H "Authorization: Bearer YOUR_API_KEY"

    You should receive a JSON response with industry classifications used throughout the dataset.

  3. Search for Plan Sponsors

    Try a basic search to find plan sponsors:

    TerminalCode
    curl -X POST "https://laborpulse-api-main-86f2470.zuplo.app/search" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "microsoft", "start": 0 }'

    This searches for sponsors with "microsoft" in their name and returns key information.

  4. Get Detailed Sponsor Information

    Use a sponsor ID from your search results to get complete details:

    TerminalCode
    curl -X GET "https://laborpulse-api-main-86f2470.zuplo.app/sponsor/SPONSOR_ID_HERE" \ -H "Authorization: Bearer YOUR_API_KEY"

    This returns comprehensive information about the sponsor, their plans, and filing history.

Authentication

The LaborLens API uses Bearer Token authentication. Include your API key in the Authorization header of every request:

Code
Authorization: Bearer YOUR_API_KEY_HERE

Rate Limits

The API is rate-limited to 50 requests per minute per API key. Rate limit information is included in response headers:

  • X-RateLimit-Limit: Maximum requests per window
  • X-RateLimit-Remaining: Remaining requests in current window
  • X-RateLimit-Reset: Time when rate limit resets

Available Endpoints

The LaborLens API provides four main endpoints:

EndpointPurposeUse Case
GET /industriesGet industry classificationsDiscover filter options for searches
POST /searchSearch plan sponsorsFind companies matching specific criteria
GET /sponsor/{id}Get sponsor detailsDeep dive into a specific company's plans
GET /filing/{ack_id}Get filing detailsAccess specific regulatory filing data

Common Search Patterns

Find Companies by Industry

JSONCode
{ "industries": ["Technology", "Software"], "min_total_participants": 500 }

Find Large Retirement Plans

JSONCode
{ "min_active_participants": 1000, "min_total_participants": 2000 }

Search by Company Name

JSONCode
{ "query": "apple inc" }

Pagination Example: Fetching All Results

When working with large datasets, you'll often need to paginate through results. Here's a complete Python example that demonstrates how to fetch all plan sponsors from a specific industry:

Code
import requests import json import csv from typing import List, Dict, Any def fetch_all_results(industries: List[str]) -> List[Dict[str, Any]]: url = "https://laborpulse-api-main-86f2470.zuplo.app/search" headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY_HERE' } all_results = [] start = 1 while True: payload = json.dumps({ "industries": industries, "start": start }) response = requests.post(url, headers=headers, data=payload) response.raise_for_status() data = response.json() results = data.get('results', []) if not results: break all_results.extend(results) print(f"Fetched {len(results)} results (page starting at {start}). Total so far: {len(all_results)}") start += 1 return all_results def save_to_csv(results: List[Dict[str, Any]], filename: str = 'industry_report.csv'): if not results: print("No results to save") return # Collect all unique field names from all records fieldnames = set() for result in results: fieldnames.update(result.keys()) fieldnames = sorted(fieldnames) with open(filename, 'w', newline='', encoding='utf-8') as csvfile: writer = csv.DictWriter(csvfile, fieldnames=fieldnames) writer.writeheader() writer.writerows(results) print(f"Saved {len(results)} records to {filename}") def main(): # Example: Fetch all results for NAICS code 621210 (Dental Offices) industries = ["621210"] print("Starting to fetch all results...") results = fetch_all_results(industries) print(f"Total results fetched: {len(results)}") save_to_csv(results) if __name__ == "__main__": main()

This example demonstrates:

  • Pagination Logic: Incrementing the start parameter until no more results are returned
  • Rate Limiting: The loop naturally respects rate limits as it makes sequential requests
  • Data Export: Saving all results to a CSV file for analysis
  • Progress Tracking: Logging the pagination progress

Replace YOUR_API_KEY_HERE with your actual API key. For production code, always store API keys as environment variables using os.environ.get('LABORLENS_API_KEY').

Error Handling

The API returns standard HTTP status codes:

  • 200: Success
  • 400: Bad Request (invalid parameters)
  • 401: Unauthorized (invalid/missing API key)
  • 429: Rate Limit Exceeded
  • 500: Internal Server Error

Error responses include detailed information to help debug issues:

JSONCode
{ "message": "Invalid search parameters: 'min_participants' must be a positive integer", "status_code": 400 }

Next Steps

  • Explore the full API Reference for detailed endpoint documentation
  • Check your usage and manage API keys in Access & Usage
  • Review the About page to understand the full scope of available data

Ready to start building? Head over to the API Reference to see all available parameters and response schemas.

Support

Need help getting started or have questions about the API? Contact our support team at support@laborlens.io.

Last modified on