# OSHA API

> OSHA workflow and API: inspections. Returns inspections, city, scope and state as JSON.

OSHA data from osha.gov: inspections.

- Page: https://fous.com/workflows/osha
- Handle: `@osha`
- Category: [Government](https://fous.com/workflows/category/government)
- Source website: https://osha.gov
- Last verified: Sep 29, 2026
- Fous is not affiliated with OSHA.

## Methods

### Search inspections

Operation `search_inspections`, version 1. 1 credit per call.

Find OSHA workplace inspections for a company, with site addresses, violations, penalties, industry and case status. Results include publicly posted information; recent citations and penalties may not yet be available.

**Input**

| Field | Type | Required | Example | Description |
|---|---|---|---|---|
| `state` | string | no | `"TN"` | State name or two-letter code, for example Tennessee or TN. |
| `status` | string | no | `"closed"` | Case status to include, for example closed. |
| `company` | string | yes | `"Tyson Foods"` | Company or establishment name, for example Tyson Foods. |
| `start_date` | string | no |  | Earliest inspection date in YYYY-MM-DD, for example 2022-01-01. Defaults to five years ago. |
| `max_results` | integer | no | `3` | Maximum inspections to return, for example 25. Up to 100. |

**Input schema**

```json
{
  "type": "object",
  "required": [
    "company"
  ],
  "properties": {
    "state": {
      "type": "string",
      "description": "State name or two-letter code, for example Tennessee or TN.",
      "examples": [
        "TN"
      ]
    },
    "status": {
      "enum": [
        "all",
        "open",
        "closed"
      ],
      "type": "string",
      "default": "all",
      "description": "Case status to include, for example closed.",
      "examples": [
        "closed"
      ]
    },
    "company": {
      "type": "string",
      "description": "Company or establishment name, for example Tyson Foods.",
      "examples": [
        "Tyson Foods",
        "Amazon",
        "CompletelyNonexistentCompanyNameABCXYZ928371"
      ]
    },
    "start_date": {
      "type": "string",
      "format": "date",
      "description": "Earliest inspection date in YYYY-MM-DD, for example 2022-01-01. Defaults to five years ago."
    },
    "max_results": {
      "type": "integer",
      "default": 25,
      "maximum": 100,
      "minimum": 1,
      "description": "Maximum inspections to return, for example 25. Up to 100.",
      "x-fous-developer": true,
      "examples": [
        3
      ]
    }
  },
  "additionalProperties": false,
  "examples": [
    {
      "state": "TN",
      "company": "Tyson Foods",
      "max_results": 3
    },
    {
      "status": "closed",
      "company": "Amazon",
      "max_results": 3
    },
    {
      "company": "CompletelyNonexistentCompanyNameABCXYZ928371"
    }
  ]
}
```

**Output**

| Field | Type | Example | Description |
|---|---|---|---|
| `inspections` | array |  | Inspections, newest first. |
| `inspections[].city` | string or null | `"Newbern"` | Site city. |
| `inspections[].scope` | string or null | `"Partial"` | Scope of inspection. |
| `inspections[].state` | string or null | `"TN"` | Site state code. |
| `inspections[].street` | string or null | `"2000 Biffle Rd"` | Site street address. |
| `inspections[].industry` | string or null | `"Animal (except Poultry) Slaughtering"` | Industry description. |
| `inspections[].zip_code` | string or null | `"38059"` | Site ZIP code. |
| `inspections[].naics_code` | string or null | `"311611"` | NAICS industry classification code. |
| `inspections[].case_status` | string or null | `"Open"` | Case status. |
| `inspections[].activity_number` | string | `"1898841.015"` | OSHA inspection activity number. |
| `inspections[].inspection_date` | string | `"2026-06-10"` | Date inspection opened, YYYY-MM-DD. |
| `inspections[].inspection_type` | string or null | `"Complaint"` | Reason or type of inspection in words. |
| `inspections[].violations_found` | boolean or null | `true` | Whether posted violations were found. |
| `inspections[].establishment_name` | string or null | `"Tyson Foods Inc"` | Name of the inspected workplace. |
| `inspections[].serious_violations` | integer or null | `1` | Current serious violations. |
| `inspections[].current_penalty_usd` | number or null | `2800` | Current total penalty in USD. |
| `inspections[].initial_penalty_usd` | number or null | `2800` | Initial total penalty in USD. |
| `inspections[].number_of_violations` | integer or null | `1` | Current number of violations. |
| `inspections[].inspection_detail_link` | string | `"https://www.osha.gov/ords/imis/establishment.inspection_detail?id=1898841.015"` | OSHA inspection detail page. |

**Example input**

```json
{
  "state": "TN",
  "company": "Tyson Foods",
  "max_results": 3
}
```

**Example output**

```json
{
  "inspections": [
    {
      "city": "Newbern",
      "scope": "Partial",
      "state": "TN",
      "street": "2000 Biffle Rd",
      "industry": "Animal (except Poultry) Slaughtering",
      "zip_code": "38059",
      "naics_code": "311611",
      "case_status": "Open",
      "activity_number": "1898841.015",
      "inspection_date": "2026-06-10",
      "inspection_type": "Complaint",
      "violations_found": true,
      "establishment_name": "Tyson Foods Inc",
      "serious_violations": 1,
      "current_penalty_usd": 2800,
      "initial_penalty_usd": 2800,
      "number_of_violations": 1,
      "inspection_detail_link": "https://www.osha.gov/ords/imis/establishment.inspection_detail?id=1898841.015"
    }
  ]
}
```

## Quick start

Call the API with a Fous API key (`FOUS_API_KEY`). To create one, turn on Developer mode in Fous Studio, then open Keys & connections → API keys (https://app.fous.com/keys).

```bash
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
: "${FOUS_API_KEY:?Set FOUS_API_KEY before running this example}"

curl 'https://api.fous.com/v1/query' \
  --fail-with-body --silent --show-error --max-time 120 \
  -H "Authorization: Bearer $FOUS_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "api": "@osha",
  "visibility": "public",
  "operation": "search_inspections",
  "version": 1,
  "input": {
    "state": "TN",
    "company": "Tyson Foods",
    "max_results": 3
  },
  "response": {
    "format": "json"
  }
}'
```

```python
# Save as fous.py and run with python3 fous.py. No packages needed.
# First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
import json
import os
import urllib.error
import urllib.request

api_key = os.environ.get("FOUS_API_KEY")
if not api_key:
    raise RuntimeError("Set FOUS_API_KEY before running this example")

body = json.loads("{\n  \"api\": \"@osha\",\n  \"visibility\": \"public\",\n  \"operation\": \"search_inspections\",\n  \"version\": 1,\n  \"input\": {\n    \"state\": \"TN\",\n    \"company\": \"Tyson Foods\",\n    \"max_results\": 3\n  },\n  \"response\": {\n    \"format\": \"json\"\n  }\n}")
request = urllib.request.Request(
    "https://api.fous.com/v1/query",
    data=json.dumps(body).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    method="POST",
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise RuntimeError(f"HTTP {error.code}: {error.read().decode('utf-8', errors='replace')}") from error
if result.get("success") is False:
    raise RuntimeError(result.get("error", {}).get("message", "Request failed"))
print(json.dumps(result["data"]["output"], indent=2))
```

```typescript
// Save as fous.mts and run with npx tsx fous.mts.
// First set your key: export FOUS_API_KEY='YOUR_FOUS_API_KEY'
const apiKey = process.env.FOUS_API_KEY;
if (!apiKey) throw new Error("Set FOUS_API_KEY before running this example");

const response = await fetch("https://api.fous.com/v1/query", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  signal: AbortSignal.timeout(120_000),
  body: JSON.stringify({
  "api": "@osha",
  "visibility": "public",
  "operation": "search_inspections",
  "version": 1,
  "input": {
    "state": "TN",
    "company": "Tyson Foods",
    "max_results": 3
  },
  "response": {
    "format": "json"
  }
}),
});
type ApiResult = { success: boolean; data?: { output: unknown }; error?: { message: string } };
const result: ApiResult = await response.json();
if (!response.ok || result.success === false) {
  throw new Error(result.error?.message ?? `HTTP ${response.status}`);
}
if (!result.data) throw new Error("Missing API response data");
console.log(result.data.output);
```

Or describe the data in plain language: send `{"api":"@osha","prompt":"Describe the data you need, with every detail"}` to the same URL. Fous fills in the input, runs the method that fits and returns only the fields you asked for; `data.route.calls[].request` is the exact call it made. Routing is free; the run costs the same.

## FAQ

### Is Fous affiliated with OSHA?

No. Fous is not affiliated with OSHA. This workflow reads the public osha.gov website and returns its data.

### How much does it cost?

Each run costs 1 credit. With pay-as-you-go, a credit costs 1¢; monthly plans cost less per credit.

### Do I need a OSHA account?

No. You only need a Fous account.

### How current is the data?

Fous gets the data from osha.gov when you run it; repeating the same request within a day may return the saved result. Fous checks this workflow automatically; it last passed a check on Sep 29, 2026.

## Related

- [Companies House API](https://fous.com/workflows/companies-house.md): Companies House returns UK public-register company details, officers, people with significant control and recent filings; records may be incomplete, and ceased entries are optional.
- [FDA API](https://fous.com/workflows/fda.md): FDA provides drug safety data, latest matching drug labels, common reported side effects, and newest-first drug, food, and device recalls; recent drug and device recalls may be missing, and weekly food statuses may lag.
- [IRS API](https://fous.com/workflows/irs.md): IRS provides tax information and public organization records, including charity status and current-directory forms, instructions, and publications with revision and posting dates.
- [Annuaire des Entreprises API](https://fous.com/workflows/annuaire-des-entreprises.md): French government directory of public company registrations.
- [Bureau of Labor Statistics API](https://fous.com/workflows/bureau-of-labor-statistics.md): Bureau of Labor Statistics provides latest occupation pay, employment, career outlooks, unemployment, category inflation (up to 24 months’ history), and CPI conversions from January 1913.
- [CPSC API](https://fous.com/workflows/cpsc.md): U.S. Consumer Product Safety Commission recalls and product safety information.
- [USAJOBS API](https://fous.com/workflows/usajobs.md): Federal government job listings and announcements.
- [SEC EDGAR API](https://fous.com/workflows/sec-edgar.md): SEC EDGAR provides filings, annual and quarterly financials, exact-phrase matches, up to 200 insider trades, and quarterly 13F manager holdings; older filings appear when available.
- [All Government workflows](https://fous.com/workflows/category/government)
